login
Let f(x) be the absolute value of the difference between x and its base-2 reversal. a(n) is the number of times f(x) must be applied starting with n for the result to be 0.
2

%I #23 Nov 05 2015 12:22:13

%S 1,2,1,2,1,2,1,2,1,2,3,2,3,2,1,2,1,2,3,2,1,2,3,2,3,2,1,2,3,2,1,2,1,2,

%T 3,2,3,4,3,4,3,2,3,2,1,2,3,2,3,2,1,4,3,2,3,4,3,4,3,2,3,2,1,2,1,2,3,2,

%U 3,2,3,2,1,2,3,2,3,2,3,4,3,2,3

%N Let f(x) be the absolute value of the difference between x and its base-2 reversal. a(n) is the number of times f(x) must be applied starting with n for the result to be 0.

%C First differences appear to always be odd.

%C More precisely, a(n) is even if n is even and a(n) is odd when n is odd. This is an immediate consequence of the parities in A055945 (which represents f apart from the sign) and the fact that we count iterations of f until the result is even. - _Jörgen Backelin_, Nov 04 2015

%p A259656 := proc(n)

%p local f,a ;

%p f := n ;

%p a := 0 ;

%p while f <> 0 do

%p f := abs(A055945(f)) ;

%p a := a+1 ;

%p end do:

%p a;

%p end proc: # _R. J. Mathar_, Nov 04 2015

%Y Cf. A055945.

%K nonn,base

%O 1,2

%A _Dylan Hamilton_, Jul 02 2015