login
A216431
a(0)=0; thereafter a(n+1) = a(n) + 1 + number of 0's in binary representation of a(n), counted with A023416.
5
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,2
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.
LINKS
FORMULA
If n<2, a(n) = 2n, otherwise, a(n) = A233272(a(n-1)). - Antti Karttunen, Dec 12 2013
MATHEMATICA
NestList[#+1+DigitCount[#, 2, 0]&, 0, 60] (* Harvey P. Dale, Sep 25 2013 *)
PROG
(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
CROSSREFS
Differs from A233271 only in that this jumps directly from 0 to 2 in the beginning.
Sequence in context: A001839 A087686 A232054 * A233271 A088413 A372098
KEYWORD
nonn,base
AUTHOR
Alex Ratushnyak, Sep 08 2012
EXTENSIONS
Name edited by Antti Karttunen, Dec 12 2013
STATUS
approved