Little math problems September 2018
09-24-2018, 12:53 AM
Post: #7
 Valentin Albillo Senior Member Posts: 1,098 Joined: Feb 2015
RE: Little math problems September 2018
.
Hi, Pier:

(09-20-2018 11:21 AM)pier4r Wrote:  Find two positive integers such that: the sum of whose squares is a cube and the sum of whose cubes is a square.

There are several ways to attack this problem depending on the particular mix of brute force and theory one wants to employ. The fastest, more thoughtful way is to use congruences and subsequent parameterization while the easiest way, the one which requires less thinking and math foreknowledge, is simply to use brute force with or without additional finesses to reduce the running times.

A simple 12-line program (503 bytes, 70% brute force + 30% finesse) for the HP-71B quickly produces all 7 unique (up to x-y symmetry) solutions for z in [1, 2000], namely:

(2,2), (128, 128), (1250, 625), (1458, 1458), (8192, 8192), (31250, 31250), (80000, 40000)

and infinitely more can be found by simply expanding the search range, though at this point it's more efficient (albeit more convoluted) to begin using congruences and parameterization, as stated.

Another way to proceed is to perform algebraic manipulations using divisibility criteria. It quickly gets somewhat laborious for the general case but for a relevant particular case it's dead easy and it allowed me to create a simple 20ish-step RPN program which runs on every classic RPN machine from the HP-10 or HP-25C to the HP42S, say, and which will produce in seconds exact solutions up to 10-digit or 12-digit long, depending on the machine.

The version for the HP-15C is just 19 steps and produces 41 solutions ranging from (2,2) to (9500208482, 9500208482):

9500208482 ^ 2 + 9500208482 ^ 2 = 180507922402929488648 = 5651522 ^ 3
9500208482 ^ 3 + 9500208482 ^ 3 = 1714862895480508549701652312336 = 1309527737575844 ^ 2

The version for the HP42S is similarly compact and produces 89 solutions, again in seconds, ranging from (2,2) to (993962581922, 993962581922):

993962581922 ^ 2+993962581922 ^ 2 = 1975923228522097122428168 = 125484482 ^ 3
993962581922 ^ 3+993962581922 ^ 3 = 1963993753901477688038748399260378896 = 1401425614829940836 ^ 2

Finally, using a version of this same RPN program for multiprecision software you can produce solutions of any size, say:

7081411940532321969341507101262893738689268797761826852357921359507223378 ^ 2 +
7081411940532321969341507101262893738689268797761826852357921359507223378 ^ 2=

10029279014302749179904378265599862005294195018425352469280088087093653074
3348010035520988277313336460873377556821353492473182309595873918379461768

= 4646114457816754433119112162063873699817342813282 ^ 3

7081411940532321969341507101262893738689268797761826852357921359507223378 ^ 3+
7081411940532321969341507101262893738689268797761826852357921359507223378 ^ 3=

71021456166813724373369160917786492001894725287832594459295292562401596433
91012000742769466486927456148133623926599939967004913734032030065738557704
01365222261117051148735876729922150054442435311887353433629595786812304

=

266498510627758901877702659634170893109466921127927695666500424568907165355
87505472077470689588260565184577452 ^ 2

and of course it's equally easy to derive similar algorithms for other particular cases and use them to create additional small RPN programs to produce many more solutions very quickly.

Thanks for the interesting mini-challenge and best regards.
V.
.

All My Articles & other Materials here:  Valentin Albillo's HP Collection

 « Next Oldest | Next Newest »

 Messages In This Thread Little math problems September 2018 - pier4r - 09-20-2018, 11:21 AM RE: Little math problems September 2018 - Thomas Klemm - 09-20-2018, 12:54 PM RE: Little math problems September 2018 - Albert Chan - 09-20-2018, 01:03 PM RE: Little math problems September 2018 - Albert Chan - 09-20-2018, 02:37 PM RE: Little math problems September 2018 - Albert Chan - 09-25-2018, 02:46 AM RE: Little math problems September 2018 - ijabbott - 09-20-2018, 04:55 PM RE: Little math problems September 2018 - Albert Chan - 09-20-2018, 05:22 PM RE: Little math problems September 2018 - Valentin Albillo - 09-24-2018 12:53 AM RE: Little math problems September 2018 - Albert Chan - 09-24-2018, 12:18 PM RE: Little math problems September 2018 - Valentin Albillo - 09-25-2018, 12:48 AM RE: Little math problems September 2018 - Albert Chan - 09-28-2018, 04:51 PM RE: Little math problems September 2018 - pier4r - 09-25-2018, 10:56 AM RE: Little math problems September 2018 - Valentin Albillo - 09-25-2018, 04:09 PM RE: Little math problems September 2018 - pier4r - 09-26-2018, 03:55 PM RE: Little math problems September 2018 - Valentin Albillo - 09-26-2018, 08:13 PM RE: Little math problems September 2018 - Albert Chan - 09-26-2018, 10:20 PM RE: Little math problems September 2018 - pier4r - 09-28-2018, 01:36 PM RE: Little math problems September 2018 - pier4r - 09-27-2018, 10:42 PM RE: Little math problems September 2018 - Albert Chan - 09-27-2018, 11:45 PM

User(s) browsing this thread: 1 Guest(s)