There is a finite result set when performing this calculation. For example, the number 9 is in that result set.
Test: Don't even worry about choosing a number, just hit Next on the first page, note what the gift is for the number 9 and you've got the right one. I think another number in the finite result set is 54 and etc, etc, etc.
So, you can just look at box 9 and 54 then look at the rest of the boxes looking for the same gift in 9 and 54, that will define the rest of the result set.
I'm not going to take the time to define the rest of the set, but it is kind of cool the first few tries, hehe.