All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
Cubing the square (Posted on 2013-01-30) Difficulty: 3 of 5

I'm thinking of a number, x, whose last 3 digits are somewhere between 400 and 500.

You could probably guess from those digits that it might be a square or a cube, but in fact it turns out to be both, and in fact the smallest possible such number.

What are the prime factors of x?

Extra credit: feeling adventurous, I next computed the smallest number, y, having the same last 3 digits, that was a seventh power, as well as a square and a cube.

What are the prime factors of y?

See The Solution Submitted by broll    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 3 of 8 |

 10   for Last3=400 to 500
 20   for Prefix=1 to 999
 30      X=1000*Prefix+Last3
 40      Sr=int(sqrt(X))
 50      if Sr*Sr=X then
 60       :Cr=int(X^(1/3)+0.5)
 70       :if Cr*Cr*Cr=X then
 80          :print X
 90   next Prefix
100   next Last3

finds 531441, which is 3^12.

Now we're looking for the smallest perfect square, cube and 7th power all rolled into one that ends in 441. There's no point in using any composite number, as a smaller number having the same attributes can be obtained by using the corresponding power of any of its prime factors, the lowest of which will produce the lowest power that fits. No power of 2 is going to end in 441, so we try 3.

10   for P=1 to 99999999
20     Pr=modpow(3,P,1000)
30     if Pr=441 then print P,P @ 7,P @ 3:inc Ct:if Ct>30 then stop
40   next

finds

12      5       0
112     0       1
212     2       2
312     4       0
412     6       1
512     1       2
612     3       0
712     5       1
812     0       2
912     2       0
1012    4       1
1112    6       2
1212    1       0
1312    3       1
1412    5       2
1512    0       0
1612    2       1
1712    4       2
1812    6       0
1912    1       1
2012    3       2
2112    5       0
2212    0       1
2312    2       2
2412    4       0
2512    6       1
2612    1       2
2712    3       0
2812    5       1
2912    0       2
3012    2       0

showing that indeed 3^12 ends in 441 as found before, and also every 100th power of 3 thereafter also ends in 441. All these powers are even, so the perfect square part is solved automatically. We need the shown power (i.e., the 12 + k*100) to be a multiple of 7 and of 3. The values mod 7 and mod 3 are shown, and the first power for which both are zero is 1512. So the answer to the extra credit part is 3^1512 =

 2554683694788851348440970794833804806568965940628992912081032859013252509485941
58472224489338828372973882732515379571137707636085937599196644183555705781391834
27778955948121147213594610589305821689559693223086684759822238534791015461987550
45349661438585036599801300050531647948960636094789301639590147707442003224982403
18398413810511819260586370519936237924927299798401629708160484166738535513489089
04695312650278989145681592204499709453635612022330834777006703420380664418917009
87364485304130291707297510330266769534916744729784203252926097941633515936691248
77386425645286997353100152993373168805477191388415084376678557807191683739730123
76162104212933946291903160427108526286432708074279607870428889724345242025608561
441

But there's a flaw in my logic above. While a smaller combo of cube, square and 7th power can be obtained from just one of its component prime powers, they won't end in 441. And 3 might not be the prime to give the lowest, as we had to go all the way to 1512 to get the correct combination of powers.

Well, if we use 21 instead of 3 we get:

pwr   mod 7   mod 3
2       2       2
52      3       1
102     4       0
152     5       2
202     6       1
252     0       0
302     1       2
352     2       1
402     3       0
452     4       2
502     5       1
552     6       0
602     0       2
652     1       1
702     2       0
752     3       2
802     4       1
852     5       0
902     6       2
952     0       1
1002    1       0
1052    2       2

so 21^252 works. That's equal to

 1582203252500592491845747888695298248081639276478397187744095265132908962294302
66461611174521515347098010151418415542081688770374816220332273359201079760974564
53412940978997596312741169563740404937843671562520976907952503886429904767676753
96673944812966746709351384470693376031922482846367898634947883274410755447354148
382404436655441

It seems hit or miss trying to find the appropriate base. However 11 does seem to offer quite a low value:

11^84 =  2999062754174580621444557664122388274963717433652437940577512878446736163557021296243441

So to check out that this is the lowest, all numbers up to 121 were checked to see if their 42nd power (i.e., 2*3*7) ends in 441:

10 for i=3 to 121
20     p=modpow(i,42,1000)
30     if p=441 then print i:print i^42
40 next
run
 121
2999062754174580621444557664122388274963717433652437940577512878446736163557021296243441

121^42 is the lowest, that is, 11^84.


  Posted by Charlie on 2013-01-30 15:56:53
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (14)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information