login
A096370
a(n) is one greater than the number of repeated applications of the Reverse and Add (RA) transform applied to the binary representation of n that are required to reach a palindrome, or a(n)=0 if a palindrome is never reached.
0
1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 3, 2, 1, 2, 1, 2, 5, 6, 1, 0, 3, 2, 5, 0, 1, 0, 3, 2, 1, 2, 1, 2, 0, 2, 0, 2, 3, 2, 0, 2, 3, 4, 1, 0, 0, 2, 0, 4, 1, 2, 3, 4, 3, 2, 3, 4, 3, 0, 0, 2, 1, 2, 1, 2, 0, 2, 3, 2, 5, 4, 1, 12, 0, 6, 0, 0, 3, 2, 3, 2, 5, 0, 1, 0, 3, 6, 0, 0, 3, 4, 1, 0, 0, 2, 0, 4, 1, 2, 5, 2, 11, 12
OFFSET
1,2
EXAMPLE
For n=20, we have 20=10100 (base 2) and
(RA^0)10100=10100
(RA^1)10100=11001
(RA^2)10100=101100
(RA^3)10100=111001
(RA^4)10100=1100000
(RA^5)10100=1100011 (a palindrome).
Thus a(20)=5+1=6.
For n=22, we get
(RA^9)=> 1101000101
(RA^13)=> 110010001101
(RA^17)=> 11000100011101
(RA^21)=> 1100001000111101
(RA^25)=>110000010001111101
(RA^(4k+1)=>1^2 0^(k-1) 1 0^3 1^(k-1) 0 1, where here 0^k denotes 000...0 (k times). A regular pattern also occurs for the intermediate values, showing that a palindrome never occurs. Thus a(22)=0.
CROSSREFS
Sequence in context: A354599 A303536 A259656 * A330721 A076622 A194513
KEYWORD
nonn,base
AUTHOR
John W. Layman, Jul 19 2004
STATUS
approved