OFFSET
1,2
COMMENTS
Binary weight is given by A000120.
a(2^k) = k+1 for any k>=0.
a(2^k-1) = 1 for any k>0.
a(A057168(k)) = a(k)+1 for any k>0.
a(A036563(k+1)) = k for any k>0.
Ordinal transform of A000120. - Alois P. Heinz, Dec 23 2018
LINKS
Paul Tek, Table of n, a(n) for n = 1..10000
Paul Tek, PERL program for this sequence
FORMULA
a(n) = 1 + A068076(n). - Antti Karttunen, May 22 2017
EXAMPLE
The numbers with binary weight 3 are: 7, 11, 13, 14, 19, ...
Hence: a(7)=1, a(11)=2, a(13)=3, a(14)=4, a(19)=5, ...
And more generally: a(A014311(k))=k for any k>0.
MAPLE
a:= proc() option remember; local a, b, t; b, a:=
proc() 0 end, proc(n) option remember; a(n-1);
t:= add(i, i=convert(n, base, 2)); b(t):= b(t)+1
end; a(0):=0; a
end():
seq(a(n), n=1..120); # Alois P. Heinz, Dec 23 2018
PROG
(Perl) # See Links section.
(Haskell)
import Data.IntMap (empty, findWithDefault, insert)
a263017 n = a263017_list !! (n-1)
a263017_list = f 1 empty where
f x m = y : f (x + 1) (insert h (y + 1) m) where
y = findWithDefault 1 h m
h = a000120 x
-- Reinhard Zumkeller, Oct 09 2015
(Python)
from math import comb
def A263017(n):
c, k = 1, 0
for i, j in enumerate(bin(n)[-1:1:-1]):
if j == '1':
k += 1
c += comb(i, k)
return c # Chai Wah Wu, Mar 01 2023
CROSSREFS
KEYWORD
AUTHOR
Paul Tek, Oct 07 2015
STATUS
approved