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

 Cubing the square (Posted on 2013-01-30)

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.)
 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       0112     0       1212     2       2312     4       0412     6       1512     1       2612     3       0712     5       1812     0       2912     2       01012    4       11112    6       21212    1       01312    3       11412    5       21512    0       01612    2       11712    4       21812    6       01912    1       12012    3       22112    5       02212    0       12312    2       22412    4       02512    6       12612    1       22712    3       02812    5       12912    0       23012    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 32       2       252      3       1102     4       0152     5       2202     6       1252     0       0302     1       2352     2       1402     3       0452     4       2502     5       1552     6       0602     0       2652     1       1702     2       0752     3       2802     4       1852     5       0902     6       2952     0       11002    1       01052    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

 Search: Search body:
Forums (0)