login
A329320
a(n) = Sum_{k=0..floor(log_2(n))} 1 - A035263(1 + floor(n/2^k)).
3
0, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 3, 2, 3, 1, 2, 2, 2, 2, 3, 2, 3, 1, 2, 2, 2, 2, 3, 2, 3, 2, 3, 3, 3, 2, 3, 3, 3, 1, 2, 2, 2, 2, 3, 2, 3, 2, 3, 3, 3, 2, 3, 3, 3, 1, 2, 2, 2, 2, 3, 2, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 3, 4, 3
OFFSET
0,6
COMMENTS
Sequence which arise from attempts to simplify computing of A329319.
For all positive integers k, the subsequence a(2^k) to a(3*2^(k-1)-1) is identical to the subsequence a(3*2^(k-1)) to a(2^(k+1)-1). Also subsequences a(2^k) to a(3*2^(k-1)-1) and a(0) to a(2^(k-1)-1) always differ by 1.
LINKS
Mikhail Kurkov, Table of n, a(n) for n = 0..8191 [verification needed]
FORMULA
a(n) = a(floor(n/2)) + 1 - A035263(n+1) for n>0 with a(0)=0.
a(2^m+k) = a(k mod 2^(m-1)) + 1 for 0<=k<2^m, m>0 with a(0)=0, a(1)=1.
PROG
(PARI) a(n) = if (n==0, 0, a(floor(n/2)) + valuation(n+1, 2) % 2); \\ Michel Marcus, Nov 13 2019
(PARI) a(n)=my(s, t); while(n, n>>=valuation(n, 2); t=valuation(n+1, 2); s+=(t+1)\2; n>>=t); s \\ Charles R Greathouse IV, Oct 14 2021
CROSSREFS
Sequence in context: A163109 A359289 A286574 * A316112 A317994 A128428
KEYWORD
nonn,easy
AUTHOR
Mikhail Kurkov, Nov 10 2019 [verification needed]
STATUS
approved