Programming-Idioms

History of Idiom 74 > diff from v1 to v2

Edit summary for version 2 :

Version 1

2015-08-21, 12:55:44

Version 2

2015-08-21, 12:58:12

Idiom #74 Compute GCD

Compute the greatest common divisor x of big integers a and b. Use an integer type able to handle huge numbers.

Idiom #74 Compute GCD

Compute the greatest common divisor x of big integers a and b. Use an integer type able to handle huge numbers.

Imports
import "math/big"
Imports
import "math/big"
Code
x.GCD(nil, nil, a, b)
Code
x.GCD(nil, nil, a, b)
Comments bubble
The first two arguments can be ignored in this use case.

x, a, b have pointer type *big.Int .
Comments bubble
The first two arguments can be ignored in this use case.

x, a, b have pointer type *big.Int .
Demo URL
https://play.golang.org/p/SF-Gj_XnAH
Demo URL
https://play.golang.org/p/SF-Gj_XnAH