OFFSET
0,2
LINKS
EXAMPLE
7 is the smallest number which requires two steps to reach a base 4 palindrome (cf. A075685), so a(2) = 5; 7 (decimal) = 13 -> 13 + 31 = 110 -> 110 + 011 = 121 (palindrome) = 25 (decimal).
PROG
(PARI) {m=46; v=[]; for(j=1, m+1, v=concat(v, -1)); mc=m+1; n=0; while(mc>0, a=-1; c=0; k=n; while(c<m+1, q=k; rev=0; while(q>0, d=divrem(q, 4); q=d[1]; rev=4*rev+d[2]); if(k==rev, a=c; c=m+1, c++; k=k+rev)); if(0<=a&&a<=m, if(v[a+1]<0, v[a+1]=n; mc--; print1([a, n]))); n++); print(); for(j=1, m+1, print1(v[j], ", "))}
(Python)
from gmpy2 import digits
def A077441(n):
....if n > 0:
........k = 0
........while True:
............m = k
............for i in range(n):
................s = digits(m, 4)
................if s == s[::-1]:
....................break
................m += int(s[::-1], 4)
............else:
................s = digits(m, 4)
................if s == s[::-1]:
....................return k
............k += 1
....else:
........return 0 # Chai Wah Wu, Jan 17 2015
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Klaus Brockhaus, Nov 05 2002
STATUS
approved