cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A077441 In base 4, smallest number that requires n Reverse and Add! steps to reach a palindrome.

This page as a plain text file.
%I A077441 #15 May 22 2025 10:21:35
%S A077441 0,4,7,26,28,127,306,348,398,301,308,203,311,783,294,350,199,296,4268,
%T A077441 16595,5326,4253,17399,8235,6189,4270,3107,1270,1532,511,67816,65975,
%U A077441 24670,12395,4282,3119,28799,16861,18164,66268,45087,71164,309234
%N A077441 In base 4, smallest number that requires n Reverse and Add! steps to reach a palindrome.
%C A077441 Base-4 analog of A066058 (base 2) and A023109 (base 10).
%H A077441 Chai Wah Wu, <a href="/A077441/b077441.txt">Table of n, a(n) for n = 0..100</a>
%H A077441 <a href="/index/Res#RAA">Index entries for sequences related to Reverse and Add!</a>
%e A077441 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).
%o A077441 (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],","))}
%o A077441 (Python)
%o A077441 from gmpy2 import digits
%o A077441 def A077441(n):
%o A077441     if n > 0:
%o A077441         k = 0
%o A077441         while True:
%o A077441             m = k
%o A077441             for i in range(n):
%o A077441                 s = digits(m,4)
%o A077441                 if s == s[::-1]:
%o A077441                     break
%o A077441                 m += int(s[::-1],4)
%o A077441             else:
%o A077441                 s = digits(m,4)
%o A077441                 if s == s[::-1]:
%o A077441                     return k
%o A077441             k += 1
%o A077441     else:
%o A077441         return 0 # _Chai Wah Wu_, Jan 17 2015
%Y A077441 Cf. A075685, A066058, A023109.
%K A077441 base,nonn
%O A077441 0,2
%A A077441 _Klaus Brockhaus_, Nov 05 2002