OFFSET
0,2
COMMENTS
From Antti Karttunen, Jan 30 2022: (Start)
Write n in binary: 1ab..xyz, then a(n) = (1+1ab..xy) + (1+1ab..x) + ... + (1+1ab) + (1+1a) + (1+1) + (1+0) + 1. This method was found by LODA miner, see the assembly program at C. Krause link.
Proof: Compare to a similar formula given for A011371, with a(n) = a(floor(n/2)) + floor(n/2) to the new formula for this sequence which is a(n) = 1 + a(floor(n/2)) + floor(n/2), for n > 0 and a(0) = 1. It is easy to see that the difference between these, a(n) - A011371(n) = 1+A070939(n), for n > 0. As A011371(n) = n minus (number of 1's in binary expansion of n), then a(n) = 1 + (number of digits in binary expansion of n) + (n minus number of 1's in binary expansion of n) = 1 + n + (number of nonleading 0's in binary expansion of n), which indeed is the definition of this sequence.
(End)
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..8192
Christian Krause, et al, A mined LODA assembly source for this sequence
FORMULA
a(n) = n + A080791(n) + 1.
a(0) = 1; for n > 1, a(n) = 1 + floor(n/2) + a(floor(n/2)). - (Found by LODA miner, see comments) - Antti Karttunen, Jan 30 2022
MATHEMATICA
DigitCount[#, 2, 0] + # + 1 & [Range[0, 100]] (* Paolo Xausa, Mar 01 2024 *)
PROG
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Dec 12 2013
STATUS
approved