Iterative Faster iterative version of GcdRecursive without holding up too much of the stack
(a, b int64)
| 5 | |
| 6 | // Iterative Faster iterative version of GcdRecursive without holding up too much of the stack |
| 7 | func Iterative(a, b int64) int64 { |
| 8 | for b != 0 { |
| 9 | a, b = b, a%b |
| 10 | } |
| 11 | return a |
| 12 | } |