cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-1 of 1 results.

A286298 a(0) = 0, a(1) = 1; thereafter, a(2n) = a(n) + 1 + (n mod 2), a(2n+1) = a(n) + 2 - (n mod 2).

Original entry on oeis.org

0, 1, 3, 2, 4, 5, 4, 3, 5, 6, 7, 6, 5, 6, 5, 4, 6, 7, 8, 7, 8, 9, 8, 7, 6, 7, 8, 7, 6, 7, 6, 5, 7, 8, 9, 8, 9, 10, 9, 8, 9, 10, 11, 10, 9, 10, 9, 8, 7, 8, 9, 8, 9, 10, 9, 8, 7, 8, 9, 8, 7, 8, 7, 6, 8, 9, 10, 9, 10, 11, 10, 9, 10, 11, 12, 11, 10, 11, 10, 9, 10, 11, 12, 11, 12, 13, 12, 11, 10, 11, 12
Offset: 0

Views

Author

N. J. A. Sloane, Jun 02 2017

Keywords

Comments

Let S be a set containing 0 and let S grow in generations G(i), defined by these rules: If x is in S then 2x is in S and 1 - x is in S. So G(0) = 0, G(1) = {1}, G(2) = {2}, G(3) = {-1,4}, ... Then a(n) is the generation containing the integer k where n = 2k - 1 for k>0 and -2k for k <= 0. The question posed by Clark Kimberling was "Does each generation contain a Fibonacci number or its negative?" It has been proved that every integer occurs in some G(i). - Karyn McLellan, Aug 16 2018

Examples

			For k = -5, n = 10 and f(10) = 7, so -5 first appears in G(7). - _Karyn McLellan_, Aug 16 2018
		

References

  • C. Kimberling, Problem proposals, Proceedings of the Sixteenth International Conference on Fibonacci Numbers and Their Applications, P. Anderson, C. Ballot and W. Webb, eds. The Fibonacci Quarterly, 52.5(2014), 5-14.

Crossrefs

Cf. A000523, A005811, A286299 (first differences).

Programs

  • Maple
    f:=proc(n) option remember;
       if n <= 1 then n
       elif (n mod 2) = 0 then f(n/2)+1+((n/2) mod 2);
       else f((n-1)/2) + 2 - ((n-1)/2 mod 2); end if;
    end proc;
    [seq(f(n),n=0..120)];
  • PARI
    a(n) = if (n==0, 0, logint(n, 2) + hammingweight(bitxor(n, n>>1))); \\ Michel Marcus, Aug 21 2018
  • Python
    def A286298(n):
        if n <= 1:
            return n
        a, b = divmod(n, 2)
        return A286298(a) + 1 + b + (-1)**b*(a % 2) # Chai Wah Wu, Jun 02 2017
    

Formula

a(n) = A005811(n) + A000523(n) for n >= 1. - Karyn McLellan, Aug 16 2018
Showing 1-1 of 1 results.