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.

A216431 a(0)=0; thereafter a(n+1) = a(n) + 1 + number of 0's in binary representation of a(n), counted with A023416.

Original entry on oeis.org

0, 2, 4, 7, 8, 12, 15, 16, 21, 24, 28, 31, 32, 38, 42, 46, 49, 53, 56, 60, 63, 64, 71, 75, 79, 82, 87, 90, 94, 97, 102, 106, 110, 113, 117, 120, 124, 127, 128, 136, 143, 147, 152, 158, 162, 168, 174, 178, 183, 186, 190, 193, 199, 203, 207, 210, 215, 218, 222
Offset: 0

Views

Author

Alex Ratushnyak, Sep 08 2012

Keywords

Comments

The difference from A233271 stems from the fact that it uses A080791 to count the 0-bits in binary expansion of n, while this sequence uses A023416, which results a slightly different start for the iteration.

Crossrefs

Differs from A233271 only in that this jumps directly from 0 to 2 in the beginning.

Programs

  • Mathematica
    NestList[#+1+DigitCount[#,2,0]&,0,60] (* Harvey P. Dale, Sep 25 2013 *)
  • Python
    a = 0
    for n in range(100):
        print(a, end=', ')
        ta = a
        c0 = (a==0)
        while ta>0:
            c0 += 1-(ta&1)
            ta >>= 1
        a += 1 + c0
    
  • Scheme
    ;; With memoizing definec-macro from Antti Karttunen's IntSeq-library.
    (definec (A216431 n) (if (< n 2) (+ n n) (A233272 (A216431 (- n 1)))))
    ;; Antti Karttunen, Dec 12 2013

Formula

If n<2, a(n) = 2n, otherwise, a(n) = A233272(a(n-1)). - Antti Karttunen, Dec 12 2013

Extensions

Name edited by Antti Karttunen, Dec 12 2013