login
a(n) is the number of ways to write n as the sum of a square and the reverse of a square.
2

%I #7 Feb 28 2026 15:01:47

%S 1,2,1,0,2,2,0,0,1,2,2,0,0,2,0,0,1,1,2,1,1,0,1,0,0,2,1,1,0,1,0,0,0,0,

%T 2,0,1,1,0,0,1,0,0,1,0,1,1,1,0,1,2,0,1,2,1,1,1,0,1,0,0,2,2,1,2,2,0,2,

%U 2,0,1,1,1,1,0,0,0,2,0,1,0,1,3,0,0,1,1,0,2,0,1,0,0,0,1,2,0,1,1

%N a(n) is the number of ways to write n as the sum of a square and the reverse of a square.

%C a(n) is the number of ways to write n = x + y where x is in A000290 and y is in A074896.

%C a(n) = 0 if n == 3 or 6 (mod 9).

%H Robert Israel, <a href="/A393705/b393705.txt">Table of n, a(n) for n = 0..10000</a>

%e a(34) = 2 because 34 = 16 + 18 = 25 + 9 where 16 and 25 are squares and 18 and 9 are the reverses of the squares 81 and 9.

%p rev:= proc(n) local L,i;

%p L:= convert(n,base,10);

%p add(L[-i]*10^(i-1),i=1..nops(L))

%p end proc:

%p V:= Array(0..1000):

%p for x from 0 while x^2 <= 1000 do

%p V[x^2]:= V[x^2] + 1;

%p for i from 1 to 9 do

%p for j from 0 while (10*j+i)^2 < 1000 do

%p y:= x^2 + rev((10*j+i)^2);

%p if y <= 1000 then V[y]:= V[y]+1 fi;

%p od od od:

%p convert(V,list);

%Y Cf. A000290, A074896, A393572.

%K nonn,base

%O 0,2

%A _Robert Israel_, Feb 25 2026