ExtendedRecursive finds and returns gcd(a, b), x, y satisfying a*x + b*y = gcd(a, b).
(a, b int64)
| 7 | |
| 8 | // ExtendedRecursive finds and returns gcd(a, b), x, y satisfying a*x + b*y = gcd(a, b). |
| 9 | func ExtendedRecursive(a, b int64) (int64, int64, int64) { |
| 10 | if b > 0 { |
| 11 | d, y, x := ExtendedRecursive(b, a%b) |
| 12 | y -= (a / b) * x |
| 13 | return d, x, y |
| 14 | } |
| 15 | |
| 16 | return a, 1, 0 |
| 17 | } |
nothing calls this directly
no outgoing calls
no test coverage detected