Remember Me?

 Straight Dope Message Board Remember Me?

 Thread Tools Display Modes
#1
11-17-2019, 01:05 PM
 Guest Join Date: Nov 2001 Location: North Kakkalakee Posts: 15,481

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.

Quote:
 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:

a2 - b2 = ab ± 1
(a + b)(a - b) = ab ± 1
(a - b) = (ab ± 1) / (a + b)

a - b is a three-digit perfect square, listed here: 102 to 312

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 102 to 282, 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.
#2
11-17-2019, 01:20 PM
 Guest Join Date: Feb 2015 Location: unknown; Speed: exactly 0 Posts: 3,120
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.
#3
11-17-2019, 05:39 PM
 Charter Member Moderator Join Date: Jan 2000 Location: The Land of Cleves Posts: 86,733
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.
#4
11-17-2019, 05:57 PM
 SD Curator of Critters Moderator Join Date: Oct 2000 Location: Panama Posts: 44,226
Moved to the Game Room.

Colibri
General Questions Moderator
#5
11-17-2019, 07:19 PM
 Guest Join Date: Nov 2001 Location: North Kakkalakee Posts: 15,481
Quote:
 Originally Posted by 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 a2 - b2 = ab ± 1, but when you shifted ab over, shouldn't the result be a2 - ab - b2 ~= 0?

Also, if you're defining x == a/b, wouldn't the the result be b2x2 - ab - a2/x2 ~= 0? How did you get x2 - x -1 ~= 0? Moreover, how did you leap to x ~= (1+sqrt(5))/2?
#6
11-17-2019, 07:21 PM
 Guest Join Date: Nov 2001 Location: North Kakkalakee Posts: 15,481
Quote:
 Originally Posted by markn+ 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.
#7
11-17-2019, 08:16 PM
 Charter Member Moderator Join Date: Jan 2000 Location: The Land of Cleves Posts: 86,733
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.
#8
11-17-2019, 10:57 PM
 Charter Member Join Date: May 1999 Location: at the right hand of cool Posts: 42,251
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!

Last edited by Left Hand of Dorkness; 11-17-2019 at 10:59 PM.
#9
11-17-2019, 11:21 PM
 Guest Join Date: May 2000 Posts: 192
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.
#10
11-18-2019, 09:09 AM
 Charter Jays Fan Moderator Join Date: Jun 2000 Location: Oakville, Canada Posts: 42,243
Quote:
 Originally Posted by 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.
__________________
Providing useless posts since 1999!
#11
11-18-2019, 10:42 PM
 Guest Join Date: May 2000 Posts: 192
Another way to solve this without knowing the Cassini Identity: Let c2=a-b. Eliminate a from the two equations and solve for b, giving
b=(c2±sqrt(5c4±4)/2
For b to be integer, 5c4±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(5c4-4) in Column 2, and sqrt(5c4+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 c2=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.

 Bookmarks

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Main     About This Message Board     Comments on Cecil's Columns/Staff Reports     General Questions     Great Debates     Politics & Elections     Cafe Society     The Game Room     Thread Games     In My Humble Opinion (IMHO)     Mundane Pointless Stuff I Must Share (MPSIMS)     Marketplace     The BBQ Pit

All times are GMT -5. The time now is 07:23 AM.

 -- Straight Dope v3.7.3 -- Sultantheme's Responsive vB3-blue Contact Us - Straight Dope Homepage - Archive - Top
Copyright ©2000 - 2020, vBulletin Solutions, Inc.

Send questions for Cecil Adams to: cecil@straightdope.com