login
Nonnegative integers i such that i^2 + reverse(i)^2 is a palindrome.
3

%I #28 Apr 10 2015 09:46:39

%S 0,1,2,10,11,12,20,21,30,100,101,102,110,111,120,200,201,210,220,300,

%T 310,1000,1001,1002,1010,1011,1012,1020,1021,1022,1100,1101,1102,1110,

%U 1111,1120,1200,1201,1210,1300,2000,2001,2010,2011,2100,2101,2110,2200,2201

%N Nonnegative integers i such that i^2 + reverse(i)^2 is a palindrome.

%C This sequence generates A256398.

%H Bui Quang Tuan, <a href="/A256437/b256437.txt">Table of n, a(n) for n = 1..554</a>

%e 12 is in the sequence because 12^2 + 21^2 = 585, a palindrome.

%t palQ[n_] := Reverse@ IntegerDigits@ n == IntegerDigits@ n; Select[

%t Range@2210, palQ[#^2 + FromDigits[Reverse[IntegerDigits@ #]]^2] &] (* _Michael De Vlieger_, Mar 29 2015 *)

%o (PARI) rev(n)=r=""; d=digits(n); for(i=1, #d, r=concat(Str(d[i]), r)); eval(r);

%o ispal(n) = d = digits(n); Vecrev(d) == d;

%o isok(n) = ispal(n^2+rev(n)^2) \\ _Michel Marcus_, Apr 01 2015

%o (Python)

%o A256437_list = [i for i in range(10**6) if str(i**2 + int(str(i)[::-1])**2) == str(i**2 + int(str(i)[::-1])**2)[::-1]] # _Chai Wah Wu_, Apr 09 2015

%Y Cf. A002113, A004086, A256398.

%K nonn,base

%O 1,3

%A _Bui Quang Tuan_, Mar 29 2015