Number Theory: Problem 1

Correct solution

x y r
6409 42823 6409
42823 6409 4369
6409 4369 2040
4369 2040 289
2040 289 17
289 17 0
17 0 N/A

The return value is 17.


Did you explicitly show the output value? It's easy to lose points on exams by not following instructions like this one.

If your table had a lot more steps, were you subtracting off the smaller number rather than taking the remainder?

Did you start with the numbers in the order given, i.e. so the first iteration swaps the values of x and y?

The last line is technically necessary, because the main variables are reset before the loop halts. If a picky person is grading your solution, they might take off points for not including it.