OFFSET
0,5
LINKS
Robert Israel, Table of n, a(n) for n = 0..6613
FORMULA
a(n) = A052036(2^n). - David Wasserman, Nov 11 2004
EXAMPLE
a(9) = 3 as 2^9 = 512, 512 +3 = 515 is a palindrome.
MAPLE
rev:= proc(n) local L, i;
L:= convert(n, base, 10);
add(L[-i]*10^(i-1), i=1..nops(L))
end proc:
f:= proc(n) local d, e, x, y;
d:= ilog10(n)+1;
e:= floor(d/2);
x:= floor(n/10^e);
if d::even then
y:= x*10^e + rev(x);
if y >= n then y - n else (x+1)*10^e + rev(x+1) - n fi;
else
y:= x*10^e + rev(floor(x/10));
if y >= n then y - n else (x+1)*10^e + rev(floor((x+1)/10)) - n fi
fi;
end proc:
map(f, [seq(2^n, n=0..50)]); # Robert Israel, Feb 17 2026
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy and Meenakshi Srikanth (menakan_s(AT)yahoo.com), May 01 2003
EXTENSIONS
More terms from David Wasserman, Nov 11 2004
STATUS
approved
