Games Magazine Wild Cards numbers game

The January 2020 edition of Games magazine had a Wild Cards puzzle that I couldn’t solve, and the solution they gave doesn’t provide the steps taken to arrive at the answer. There has to be a better way than trial and error.

The second statement can be expressed as:

a[sup]2[/sup] - b[sup]2[/sup] = ab ± 1
(a + b)(a - b) = ab ± 1
(a - b) = (ab ± 1) / (a + b)

a - b is a three-digit perfect square, listed here: 10[sup]2[/sup] to 31[sup]2[/sup]

I ruled out the top three, since the difference between two three digit numbers can’t be more than 800. So, we’re left with 10[sup]2[/sup] to 28[sup]2[/sup], 19 possibilities for a - b.

If a or b is prime, that leaves 145 possibilities for either, listed here.

At this point, I couldn’t figure out any way to simplify or narrow down the possibilities. Going forward, I could only see using trial and error, and there’s way too many permutations to slog through.

And so Doper geniuses, I turn to you. What’s the proper way to determine the solution? Here it is in spoiler tags, in case this stumps you too.

[spoiler]236 and 377
Difference: 377 - 233 = 144 = 12 x 12
Difference of squares: 377 x 377 - 233 x 233 = 87840
Product: 377 x 233 = 87841
233 is prime
377 = 13 x 29

Note: The number pairs for which the second statement in the puzzle is true are successive numbers in the Fibonacci series.[/spoiler]

Probably not what you want, but I just wrote a quick 15-line Perl script to search all 900*900 possibilities. Took me about 2 minutes.

Nitpick: there’s a typo in one of the numbers in the first line of your spoiler.

OK, start from the first equation, a^2 - b^2 = ab ± 1. Since a and b are both three-digit numbers, ab is going to be five to seven digits, meaning that that ±1 is almost irrelevant. So to a very good approximation, a^2 - ab + b^2 = 0. Defining x == a/b, this means that x^2 - x - 1 ~= 0, or x ~= (1+sqrt(5))/2 ~= 1.61803 (incidentally, the Golden Ratio, phi). In other words, a ~= 1.61803 * b, or a-b ~= 0.61803*b is a perfect square, or b is a three-digit perfect square times 1.61803 . That only leaves us nine numbers to check, 100 to 324 (any higher square would leave a and/or b with four digits).

Just computing the b values corresponding to those perfect squares, I notice very quickly that phi144 is very, very close to an integer. So let’s start there. phi144 = 232.99632, so call it 233. And 233*phi = 377.001919, also really close to an integer. So it looks really likely that our numbers will be 233 and 377.

377^2 - 233^2 = 142129 - 54289 = 87840, and 233*377 = 87841. Looks like we’ve got it.

Moved to the Game Room.

Colibri
General Questions Moderator

The first equation is a[sup]2[/sup] - b[sup]2[/sup] = ab ± 1, but when you shifted ab over, shouldn’t the result be a[sup]2[/sup] - ab - b[sup]2[/sup] ~= 0?

Also, if you’re defining x == a/b, wouldn’t the the result be b[sup]2[/sup]x[sup]2[/sup] - ab - a[sup]2[/sup]/x[sup]2[/sup] ~= 0? How did you get x[sup]2[/sup] - x -1 ~= 0? Moreover, how did you leap to x ~= (1+sqrt(5))/2?

Good job, but I doubt knowledge of Perl was a requirement. :slight_smile:

The first line of the spoiler should be 233, not 236. Thanks for spotting that.

The first was a typo in the post, that was not reflected in my actual calculations: It should say a^2 - ab - b^2 = 0. The same typo did not show up in the x equation.

The second came from replacing every instance of a with x*b (and leaving the instances of b alone), and then factoring out all of the b^2 pieces.

And the third was the Quadratic Formula. There are actually two solutions, but the other solution corresponded to calling a the smaller number and b the larger number, which is really no different.

I dunno if this is helpful, but you can rule out any pair in which both numbers are even. The squares of an even number will always be even, the product of two even numbers will always be even, and the difference between the squares of two even numbers will always be even. So you can’t have a2 - b2 = ab ± 1, since that would lead to one result or the other being odd.

If one number’s odd and the other is even, their product will be even, and the difference between the squares will be odd, so that can work. And if both are odd, then the product will be odd, and the difference between the squares will be even, so that can work. But no pairs of even numbers would work.

Edit: The hint tells you one of the numbers is prime, which means all that work is superfluous: that means one of the three-digit numbers must be odd. D’oh!

The solution given in the OP does explain where it came from: it says the 2nd relation applies to consecutive Fibonacci numbers (this follows from the Cassini identity). The difference of these is the Fibonacci number that comes before them, and it is required to be a square. The only square Fibonacci numbers are 0, 1, and 144. Only 144 is 3 digits, and b and a must be the next two Fibonacci numbers: 233 and 377.

Chronos’ approach is headed in the direction of Fibonacci numbers too, since ratio of the two values is very close to the golden ratio.

Wait, what? 999-100=899.

Another way to solve this without knowing the Cassini Identity: Let c[sup]2[/sup]=a-b. Eliminate a from the two equations and solve for b, giving
b=(c[sup]2[/sup]±sqrt(5c[sup]4[/sup]±4)/2
For b to be integer, 5c[sup]4[/sup]±4 must be a perfect square. Values of c meeting this can be found using the solution to Pell’s equation, but it easier to just make a spreadsheet. Put “10” (representing c) in Column 1, sqrt(5c[sup]4[/sup]-4) in Column 2, and sqrt(5c[sup]4[/sup]+4) in Column 3. Drag the three cells down until Column 1 contains 31 (to cover all cases with c having 3 digits). It is immediately clear which value in Column 2 or 3 is the only integer: c=12, and the radical is 322.

Plug into the expression for b and add c[sup]2[/sup]=144 to get a. The ± results in two solutions:
a=55 and b=-89 (which is rejected because they are not 3 digits)
a=377 and b=233.