Greatest common divisor: Difference between revisions
Content added Content deleted
m (→Builtin: library change) |
|||
Line 833: | Line 833: | ||
</lang> |
</lang> |
||
===Builtin=== |
===Builtin=== |
||
(This is just a wrapper for <tt>big. |
(This is just a wrapper for <tt>big.GCD</tt>) |
||
<lang go>package main |
<lang go>package main |
||
Line 842: | Line 842: | ||
func gcd(x, y int64) int64 { |
func gcd(x, y int64) int64 { |
||
return new(big.Int).GCD(nil, nil, big.NewInt(x), big.NewInt(y)).Int64() |
|||
big.GcdInt(result, nil, nil, big.NewInt(x), big.NewInt(y)) |
|||
return result.Int64() |
|||
} |
} |
||
Line 851: | Line 849: | ||
fmt.Println(gcd(49865, 69811)) |
fmt.Println(gcd(49865, 69811)) |
||
}</lang> |
}</lang> |
||
Output in either case |
{{out|Output in either case}} |
||
<pre> |
<pre> |
||
11 |
11 |