OFFSET
1,3
COMMENTS
All palindromes are in this sequence, hence it is infinite.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..20000
MAPLE
a:= proc(n) option remember; local k; for k from 1+
`if`(n=1, -1, a(n-1)) while not issqr(abs(k-(s->
parse(cat(s[-i]$i=1..length(s))))(""||k))) do od: k
end:
seq(a(n), n=1..100); # Alois P. Heinz, Nov 18 2016
MATHEMATICA
Select[Range@ 262, IntegerQ@ Sqrt@ Abs[# - FromDigits@ Reverse@ IntegerDigits@ #] &] (* Michael De Vlieger, Nov 18 2016 *)
PROG
(Python 2.7.7)
import math
n = 0
while True:
if math.sqrt(abs(n-int(str(n)[::-1])))%1 == 0:
print n
n += 1 # Jonathan Frech, Nov 18 2016
(PARI) is(n) = issquare(abs(n - eval(concat(Vecrev(Str(n)))))) \\ Felix Fröhlich, Nov 18 2016
(PARI) is(n, {b=10}) = issquare(abs(n - subst(Polrev(digits(n, b), 'x), 'x, b))); \\ Gheorghe Coserea, Nov 27 2016
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Jonathan Frech, Nov 18 2016
STATUS
approved