login
a(n) = A080578(n)-2n.
6

%I #18 Apr 29 2023 10:34:09

%S 0,1,0,1,2,1,0,1,2,1,2,3,2,1,0,1,2,1,2,3,2,1,2,3,2,3,4,3,2,1,0,1,2,1,

%T 2,3,2,1,2,3,2,3,4,3,2,1,2,3,2,3,4,3,2,3,4,3,4,5,4,3,2,1,0,1,2,1,2,3,

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

%N a(n) = A080578(n)-2n.

%C Terms between 2^n and 2^(n+1) as n goes to infinity tend to the sequence : 0,1,2,1,2,3,2,1,2,3,2,3,4,3,2,1,2,3,2,3,4,3,2,3,4,3,4,5,4,3,2,1,....

%H Michael De Vlieger, <a href="/A080468/b080468.txt">Table of n, a(n) for n = 2..16384</a>

%F a(2^n) = 0; Sum_{k=2^n..2^(n+1)} a(k) = n*2^(n-1) = A001787(n).

%t nn = 120; c[_] := False; j = 1; c[1] = True; Reap[Do[Set[k, If[c[n], j + 1, j + 3]]; Set[{a[n], c[k], j}, {k - 2 n, True, k}]; Sow[a[n]], {n, 2, nn}] ][[-1, -1]] (* _Michael De Vlieger_, Apr 29 2023 *)

%Y Cf. A045412, A055938, A080578, A087805.

%K nonn

%O 2,5

%A _Benoit Cloitre_, Oct 12 2003