Le Monde puzzle [#843]

A straightforward Le Monde mathematical puzzle:

Find integers x with 4 to 8 digits which are (a) perfect squares x=y² such that [x/100] is also a perfect square; (b) perfect cubes x=y³ such that [x/1000] is also a perfect cube; (c) perfect cubes x=y³ such that [x/100] is also a perfect cube (where [y] denotes here the integer part).

I first ran an R code in the train from Luxembourg that was not workng (the code not the train!), as I had started with

cubs=(34:999)^2 #perfect square
cubs=cubs[cubs%%10>0] #no 0 at the end
trubs=trunc(cubs/100)
difs=apply(abs(outer(cubs,trubs,"-")),2,min)
mots=cubs[difs==0]

If namely too high a lower bound in the list of perfect squares. It thus returned an empty set with good reasons. Using instead

cubs=(1:999)^2 #perfect square

produced the outcome

> mots
[1]  121  144  169  196  441  484  961 1681

and hence the solution 1681. For the other questions, I used

trubs=(1:999)^3
for (i in 1:length(trubs)){
cubs=trubs[i]*100+(1:99)
sol=abs(cubs-round(exp(log(cubs)/3))^3)
if (min(sol)==0){ print(cubs[sol==0])}
}

and got the outcome

[1] 125
[1] 2744

which means a solution of 2744. Same thing for

trubs=(1:999)^3
for (i in 1:length(trubs)){
cubs=trubs[i]*1000+(1:999)
sol=abs(cubs-round(exp(log(cubs)/3))^3)
if (min(sol)==0){ print(cubs[sol==0])}
}

and

[1] 1331 1728

and two solutions. (Of course, writing things on a piece of paper goes way faster…)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.