Le Monde puzzle [#939]

A Le Monde mathematical puzzle about special integers:

Find all integers with less than 11 digits that are perfect squares and can be written as a(a+6), a being an integer.

Eleven digits being too much for a brute force exploration of the form `for (t in 1:1e11)`…, some preliminary  analysis is needed, but I could not figure out a reason why there is no solution apart from 2… (I checked up to 1e8!)

Since I had “guessed” the above puzzle from the solution published one week later (!), I checked the quality of my guesswork with my friend Jean-Louis Fouley, who gave me the genuine question, based on a different interpretation of a(a+6):

Find all integers with less than 11 digits that are perfect squares and can be written as x concatenated with (x+6), x being an integer.

This is more open to brute-force R exploration (with some help from stack overflow) since x only has five digits at most!

 
perfect=function(b){
  x=FALSE
  a=trunc(sqrt(b))
  for (i in a:(a+1))
    if (i^2==b) x=TRUE
  return(x)}

for (x in 1:(1e6-1))
  if (perfect(
    as.numeric(paste(c(as.numeric(strsplit(as.character(x), "")[[1]]),
    as.numeric(strsplit(as.character(x+6), "")[[1]])),collapse="")))) 
      print(x)

Which returns

[1] 15
[1] 38

and then crashes for x=99994, because

strsplit(as.character(1e+05), "") 

does not return the six digits of 1e+05 but

[[1]]
[1] "1" "e" "+" "0" "5"

instead. Except for this value of x, no other solution is found using this R code. And for x=99994, y=99994100000 is not a perfect square.

4 Responses to “Le Monde puzzle [#939]”

  1. Why only 2? Simple. You are looking for a solution of the type a(a+6)=y^2. So a^2+6a-y^2=0. For this to have an integer solution then sqrt(9+y^2) needs to be integer, and the only time this happens is when y=4, so y^2=16 and a=2.
    Algebra to the rescue!!

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s