# Games Magazine Wild Cards numbers game

**URL:** <https://boards.straightdope.com/t/games-magazine-wild-cards-numbers-game/843580>\
**Category:** The Game Room\
**Created:** [November 17, 2019, 6:05pm UTC](https://boards.straightdope.com/t/games-magazine-wild-cards-numbers-game/843580 "2019-11-17T18:05:23Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Knowed\_Out](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/knowed_out/32/7380_2.png) [@Knowed\_Out](https://boards.straightdope.com/u/Knowed_Out)\
**Post date:** [November 17, 2019, 6:05pm UTC](https://boards.straightdope.com/t/games-magazine-wild-cards-numbers-game/843580/1 "2019-11-17T18:05:23Z")

</div>

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.

> [@](#):
>
> Can you find two three-digit whole numbers a and b such that both the following statements are true?
> 
> The difference between a and b is a three-digit perfect square.
> 
> The difference between the squares of a and b is either 1 less or 1 more than the product of a and b.
> 
> Hint: One of the numbers is prime.

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](https://www.mathwarehouse.com/arithmetic/numbers/list-of-perfect-squares.php): 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](https://prime-numbers.fandom.com/wiki/3-Digit_Primes).

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]

---

<div class="post-metadata">

**Author:** ![markn\_1](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@markn\_1](https://boards.straightdope.com/u/markn_1)\
**Post date:** [November 17, 2019, 6:20pm UTC](https://boards.straightdope.com/t/games-magazine-wild-cards-numbers-game/843580/2 "2019-11-17T18:20:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [November 17, 2019, 10:39pm UTC](https://boards.straightdope.com/t/games-magazine-wild-cards-numbers-game/843580/3 "2019-11-17T22:39:06Z")

</div>

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 phi_144 is very, very close to an integer. So let’s start there. phi_144 = 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.

---

<div class="post-metadata">

**Author:** ![Colibri](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/colibri/32/1841_2.png) [@Colibri](https://boards.straightdope.com/u/Colibri)\
**Post date:** [November 17, 2019, 10:57pm UTC](https://boards.straightdope.com/t/games-magazine-wild-cards-numbers-game/843580/4 "2019-11-17T22:57:42Z")

</div>

Moved to the Game Room.

Colibri  
General Questions Moderator

---

<div class="post-metadata">

**Author:** ![Knowed\_Out](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/knowed_out/32/7380_2.png) [@Knowed\_Out](https://boards.straightdope.com/u/Knowed_Out)\
**Post date:** [November 18, 2019, 12:19am UTC](https://boards.straightdope.com/t/games-magazine-wild-cards-numbers-game/843580/5 "2019-11-18T00:19:50Z")

</div>

> [@Chronos](#):
>
> 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

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?

---

<div class="post-metadata">

**Author:** ![Knowed\_Out](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/knowed_out/32/7380_2.png) [@Knowed\_Out](https://boards.straightdope.com/u/Knowed_Out)\
**Post date:** [November 18, 2019, 12:21am UTC](https://boards.straightdope.com/t/games-magazine-wild-cards-numbers-game/843580/6 "2019-11-18T00:21:53Z")

</div>

> [@markn\_1](#):
>
> 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.

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

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

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [November 18, 2019, 1:16am UTC](https://boards.straightdope.com/t/games-magazine-wild-cards-numbers-game/843580/7 "2019-11-18T01:16:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Left\_Hand\_of\_Dorkness](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/left_hand_of_dorkness/32/7156_2.png) [@Left\_Hand\_of\_Dorkness](https://boards.straightdope.com/u/Left_Hand_of_Dorkness)\
**Post date:** [November 18, 2019, 3:57am UTC](https://boards.straightdope.com/t/games-magazine-wild-cards-numbers-game/843580/8 "2019-11-18T03:57:57Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Manlob](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@Manlob](https://boards.straightdope.com/u/Manlob)\
**Post date:** [November 18, 2019, 4:21am UTC](https://boards.straightdope.com/t/games-magazine-wild-cards-numbers-game/843580/9 "2019-11-18T04:21:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![RickJay](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@RickJay](https://boards.straightdope.com/u/RickJay)\
**Post date:** [November 18, 2019, 2:09pm UTC](https://boards.straightdope.com/t/games-magazine-wild-cards-numbers-game/843580/10 "2019-11-18T14:09:37Z")

</div>

> [@Knowed\_Out](#):
>
> I ruled out the top three, since the difference between two three digit numbers can’t be more than 800.

Wait, what? 999-100=899.

---

<div class="post-metadata">

**Author:** ![Manlob](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@Manlob](https://boards.straightdope.com/u/Manlob)\
**Post date:** [November 19, 2019, 3:42am UTC](https://boards.straightdope.com/t/games-magazine-wild-cards-numbers-game/843580/11 "2019-11-19T03:42:01Z")

</div>

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.
