Greatest common divisor: Difference between revisions

m
→‎Builtin: library change
m (→‎Builtin: library change)
Line 833:
</lang>
===Builtin===
(This is just a wrapper for <tt>big.GcdIntGCD</tt>)
<lang go>package main
 
Line 842:
 
func gcd(x, y int64) int64 {
result :=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 ⟶ 849:
fmt.Println(gcd(49865, 69811))
}</lang>
{{out|Output in either case:}}
<pre>
11
1,707

edits