Extended simple extended gcd
(a, b int64)
| 12 | |
| 13 | // Extended simple extended gcd |
| 14 | func Extended(a, b int64) (int64, int64, int64) { |
| 15 | if a == 0 { |
| 16 | return b, 0, 1 |
| 17 | } |
| 18 | gcd, xPrime, yPrime := Extended(b%a, a) |
| 19 | return gcd, yPrime - (b/a)*xPrime, xPrime |
| 20 | } |
no outgoing calls