Problem

Source:

Tags: combinatorics, Sum



Two positive integers are written on the blackboard. Mary records in her notebook the square of the smaller number and replaces the larger number on the blackboard by the difference of the two numbers. With the new pair of numbers, she repeats the process, and continues until one of the numbers on the blackboard becomes zero. What will be the sum of the numbers in Mary's notebook at that point? (4)