Find the highest common factor of two(positive integer) input numbers (not greater than 5000) in the minimum number of iterations.
If you use a loop, it should increment a counter, starting at 0 for the first run. The counter should be the first statement in the loop. If you use more than one loop, they too should have a similar counter.
So
counter_1=0;
counter_2=0;
...
loop{
counter_1=counter_1 + 1;
...
code
...
loop_nested{
counter_2=counter_2 + 1;
...
code
...
}
}
total_count=counter_1 + counter_2 + ...
Test cases first-number second-number-->expected-output
450 425-->25
27 23-->1
1000 1001-->1
36 54-->18
2 4000-->2
4000 2500-->500
2000 4000-->2000
99 75-->3
584 978-->2
3726 4380-->6
The code with the lowest sum of all counters for all test cases wins. There is no restriction on program length. Of course, you can't use any standard functions. There is no restriction on the language that you use.
Also, please write the sum of counters that your code produces.