login
Let f(n) = A038554(n) + delta(n,1), where delta is the Kronecker symbol. Then a(n) is the fixed point that arises from iterating f (a(n) = 0 or 1).
5

%I #18 Nov 13 2024 08:30:38

%S 0,1,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,

%T 0,1,0,1,0,1,1,0,0,1,0,1,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,1,0,

%U 0,1,1,0,0,1,1,0,0,1,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,0,1,0,1,1

%N Let f(n) = A038554(n) + delta(n,1), where delta is the Kronecker symbol. Then a(n) is the fixed point that arises from iterating f (a(n) = 0 or 1).

%C Since f(n) < n for n >= 2, the number of iterations required to reach 0 or 1 is finite.

%H Nathaniel Johnston, <a href="/A192082/b192082.txt">Table of n, a(n) for n = 0..10000</a>

%p f := proc(n) local i, b, v: v:=0: if(n=1)then return 1: fi: b:=convert(n,base,2): for i to nops(b)-1 do v:=v+((b[i]+b[i+1]) mod 2)*2^(i-1): od: return v: end: a:= proc(n) local v: v:=n: while(v>1)do v:=f(v): od: return v: end: seq(a(n), n=0..104); # _Nathaniel Johnston_, Jun 30 2011

%t a[n_] := NestWhile[FromDigits[Abs[Differences[IntegerDigits[#, 2]]], 2] &, n, # > 1 &]; Array[a, 120, 0] (* _Amiram Eldar_, Nov 12 2024 *)

%Y Cf. A038554.

%K nonn,base

%O 0

%A _Vladimir Shevelev_, Jun 23 2011