login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A329320 a(n) = Sum_{k=0..floor(log_2(n))} 1 - A035263(1 + floor(n/2^k)). 4
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 (list; graph; refs; listen; history; text; internal format)
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
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
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 11:14 EDT 2024. Contains 371791 sequences. (Running on oeis4.)