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.

A206921 Rank of the n-th binary palindrome. The minimal number of iterations A206915(A206915(...A206915(A006995(n))...)) such that the result is not a binary palindrome, a(3)=1.

This page as a plain text file.
%I A206921 #24 Feb 18 2025 03:50:54
%S A206921 2,1,1,1,2,1,3,1,2,1,1,1,1,1,4,1,2,1,1,1,3,1,1,1,1,1,2,1,1,1,2,1,2,1,
%T A206921 1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,5,1,2,1,1,1,
%U A206921 1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,2,1,1
%N A206921 Rank of the n-th binary palindrome. The minimal number of iterations A206915(A206915(...A206915(A006995(n))...)) such that the result is not a binary palindrome, a(3)=1.
%C A206921 The number of iterations such that A006995(n) = A006995(A006995(A006995(...(A206922(n))...))) [For n<>3].
%H A206921 Antti Karttunen, <a href="/A206921/b206921.txt">Table of n, a(n) for n = 1..65537</a>
%F A206921 a(n)=k, where k can be determined by the following iteration: set k=0, p(0)=A006995(n). Repeat while A178225(p(k))==1, set k=k+1, p(k)=A206915(p(k-1)) end repeat [for n<>3].
%F A206921 Recursion for n<>3:
%F A206921   Case 1: a(n)=1, if n is not a binary palindrome;
%F A206921   Case 2: a(n)=a(A206915(n))+1, else.
%F A206921 Formally: a(n)=if (A178225(n)==0) then 1 else a(A206915(n))+1
%e A206921 a(1)=2, since A006995(1)=0=A006995(A006995(2)) [==> 2 iterations; 2 is not a binary palindrome];
%e A206921 a(3)=1 by definition;
%e A206921 a(4)=1, since A006995(4)=5=A006995(4) [==> 1 iteration; 4 is not a binary palindrome];
%e A206921 a(7)=3, since A006995(7)=15=A006995(A006995(A006995(4))) [==> 3 iterations; 4 is not a binary palindrome];
%o A206921 (C) /* C program fragment, omitting formal details, n!=3 */
%o A206921 k=0;
%o A206921 p=A006995(n);
%o A206921 while A178225(p)==1
%o A206921 {
%o A206921   k++;
%o A206921   p=A206915(p);
%o A206921 }
%o A206921 return k;
%o A206921 (PARI)
%o A206921 up_to = 65537;
%o A206921 A178225(n) = (Vecrev(n=binary(n))==n);
%o A206921 A206915list(up_to) = { my(v=vector(up_to+1), s=0); for(n=1,up_to+1,s += A178225(n-1); v[n] = s); (v); };
%o A206921 v206915 = A206915list(up_to);
%o A206921 A206915(n) = v206915[1+n];
%o A206921 A206921(n) = if((3==n)||!A178225(n),1,1+A206921(A206915(n))); \\ _Antti Karttunen_, Nov 14 2018
%Y A206921 Cf. A006995, A206922, A178225, A206915, A154809.
%K A206921 nonn,base
%O A206921 1,1
%A A206921 _Hieronymus Fischer_, Mar 12 2012