Le Monde puzzle [#818]

The current puzzle is as follows:

Define the symmetric of an integer as the integer obtained by inverting the order of its digits, eg 4321 is the symmetric of 1234. What are the numbers for which the square is equal to the symmetric of the square of the symmetric?

I first consulted stackexchange to find a convenient R function to create the symmetric:

int2digit=function(x){
as.numeric(sapply(sequence(nchar(x)),
  function(y) substr(x, y, y)))}

digit2int=function(a){
as.numeric(paste(a,collapse=""))}

flip=function(x){
  digit2int(rev(int2digit(x)))}

and then found that all integers but the multiples of 10 are symmetric! only some integers involving 1,2,3 and sometimes zero would work:

> for (i in 1:1000){
+   if (i^2==flip(flip(i)^2)) print(i)}
[1] 1
[1] 2
[1] 3
[1] 11
[1] 12
[1] 13
[1] 21
[1] 22
[1] 31
[1] 101
[1] 102
[1] 103
[1] 111
[1] 112
[1] 113
[1] 121
[1] 122
[1] 201
[1] 202
[1] 211
[1] 212
[1] 221
[1] 301
[1] 311

If I am not (again) confused, the symmetric integers would be those (a) not ending with zero and (b) only involving digits whose products are all less than 10.

7 Responses to “Le Monde puzzle [#818]”

  1. […] Le Monde Puzzle 818 […]

  2. […] article was first published on Xi'an's Og » R, and kindly contributed to […]

  3. […] article was originally published on Xi’an’s Og, and kindly contributed to Zyhhwg Data […]

  4. What am I missing?
    14*14 = 196
    41*41 = 1681
    Isn’t this a counterexample to your claim?

  5. ‘all integers but the multiples of 10 are symmetric!’
    ? This is not true!

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 )

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.

%d bloggers like this: