The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A320642 Number of 1's in the base-(-2) expansion of -n. 2
2, 1, 3, 2, 4, 3, 2, 1, 3, 2, 4, 3, 5, 4, 3, 2, 4, 3, 5, 4, 6, 5, 4, 3, 5, 4, 3, 2, 4, 3, 2, 1, 3, 2, 4, 3, 5, 4, 3, 2, 4, 3, 5, 4, 6, 5, 4, 3, 5, 4, 6, 5, 7, 6, 5, 4, 6, 5, 4, 3, 5, 4, 3, 2, 4, 3, 5, 4, 6, 5, 4, 3, 5, 4, 6, 5, 7, 6, 5, 4, 6, 5, 7, 6, 8, 7, 6 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Number of 1's in A212529(n).
Define f(n) as: f(0) = 0, f(-2*n) = f(n), f(-2*n+1) = f(n) + 1, then a(n) = f(-n), n >= 1. See A027615 for the other half of f.
For k > 1, the earliest occurrence of k is n = A086893(k-1).
LINKS
Eric Weisstein's World of Mathematics, Negabinary.
Eric Weisstein's World of Mathematics, Negadecimal.
Wikipedia, Negative base.
FORMULA
a(n) == -n (mod 3).
a(n) = A000120(A005352(n)). - Michel Marcus, Oct 23 2018
EXAMPLE
A212529(11) = 110101 which has four 1's, so a(11) = 4.
A212529(25) = 111011 which has five 1's, so a(25) = 5.
A212529(51) = 11011101 which has six 1's, so a(51) = 6.
MATHEMATICA
b[n_] := b[n] = b[Quotient[n - 1, -2]] + Mod[n, 2]; b[0] = 0; a[n_] := b[-n]; Array[a, 100] (* Amiram Eldar, Jul 23 2023 *)
PROG
(PARI) b(n) = if(n==0, 0, b(n\(-2))+n%2)
a(n) = b(-n)
CROSSREFS
Sequence in context: A274121 A052306 A322886 * A046823 A224989 A124876
KEYWORD
nonn,base
AUTHOR
Jianing Song, Oct 18 2018
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 June 1 19:09 EDT 2024. Contains 373027 sequences. (Running on oeis4.)