## Le Monde puzzle [#854]

A Le Monde mathematical puzzle that sounds similar to earlier ones:

Find all integers x between 1000 and 9999 and N≥1 such Nx has the reverse sequence of digits compared with i.

For N=1, the appropriate integers x are such that the four digits are symmetrical, as in x=3553. For N≥1, I ran the following R code:

```for (i in 10^3:(5*10^3)){
dig=rev(intToDigits(i))
for (N in 2:8){
if (N*i>9999) break()
if (max(abs(intToDigits(N*i)-dig))<.1)
print(c(i,N,N*i))
}}
```

and only found the single entry

```[1] 2178    4 8712
```

where the intToDigits function was suggested to me by Pierre Pudlo:

```intToDigits <- function(x) {
if (length(x) != 1) {
warning( "x should be of length 1. Using only x[1]")
x <- x[1]
}
m <- floor(log10(x)) + 1
pow10 <- 10^(1:m)
xpow <- x * pow10 / (10^m)
xrep <- trunc(xpow) / pow10
digits <- c(xrep[1], xrep[-1]-xrep[-m]) * pow10
digits
}
```

### 2 Responses to “Le Monde puzzle [#854]”

1. Jean Louis FOULLEY Says:

Thanks so much Christian for this weekly challenge of the Monde puzzle that I have not worked out for a while.

Here is an attempt to solve this one without a computer.

Letting X=(abcd) in decimal notations so that its symmetric Y=(dcba)

Let us restrict to the case of no carry over for getting d so that d=Na with N>1
Then a(N^2)=a modulo 10 with the only acceptable solution N=4 and a=2 on account of the constraints (in particular N=4, a=4 excluded)
No we have to solve 4x(2bc8)=(8cb2) ie 4c+3=b modulo 10 and 4b+[(4c+3)/10]=c
Leading to c=7 and b=1 so that X=2178 and Y=8712

2. Jeff Breiwick Says: