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!)
A027615 Number of 1's when n is written in base -2. 12

%I #41 Jul 23 2023 06:08:12

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

%T 4,5,3,4,5,6,4,5,6,7,5,6,4,5,3,4,5,6,4,5,3,4,2,3,4,5,3,4,2,3,1,2,3,4,

%U 2,3,4,5,3,4,5,6,4,5,3,4,2

%N Number of 1's when n is written in base -2.

%C Base -2 is also called "negabinary".

%C From _Jianing Song_, Oct 18 2018: (Start)

%C 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 >= 0. See A320642 for the other half of f.

%C For k > 0, the earliest occurrence of k is n = A305750(k).

%C Conjecture: a(n) != A053737(n) if and only if there exists even k >= 4 such that n mod 2^k >= (5*2^(k+1) + 2)/3. If this holds, then the probability of a random chosen number n to satisfy a(n) != A053737(n) is 1/6. (End)

%D J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 164.

%H Jianing Song, <a href="/A027615/b027615.txt">Table of n, a(n) for n = 0..10000</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Negabinary.html">Negabinary</a>.

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Negative_base">Negative base</a>.

%F a(n) = 3*A072894(n+1) - 2*n - 3. Proof by Nikolaus Meyberg, following a conjecture by _Ralf Stephan_. - _R. J. Mathar_, Jan 11 2013

%F a(n) == n (mod 3). - _Jianing Song_, Oct 18 2018

%F a(n) = A000120(A005351(n)). - _Michel Marcus_, Oct 23 2018

%e A039724(7) = 11011 which has four 1's, so a(7) = 4.

%t a[n_] := a[n] = a[Quotient[n - 1, -2]] + Mod[n, 2]; a[0] = 0; Array[a, 100, 0] (* _Amiram Eldar_, Jul 23 2023 *)

%o (PARI) a(n) = if(n==0, 0, a(n\(-2))+n%2) /* _Jianing Song_, Oct 18 2018 */

%Y Cf. A000120, A005351, A039724, A053737, A072894, A305750, A320642.

%K nonn,base

%O 0,3

%A _Pontus von Brömssen_, Nov 14 1997

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 May 23 18:59 EDT 2024. Contains 372765 sequences. (Running on oeis4.)