OFFSET
0,4
COMMENTS
See A353293 for the corresponding k's.
LINKS
FORMULA
EXAMPLE
For n = 10:
- we have:
k 10 AND k
-- --------
1 0
2 2
3 2
4 0
5 0
6 2
7 2
8 8
9 8
10 10
- so a(10) = #{2, 3, 6, 7, 8, 9, 10} = 7.
PROG
(PARI) a(n) = { my (h=hammingweight(n), w=#binary(n)); n-2^(w-1)+1 + (2^(h-1)-1)*2^(w-h) }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Apr 09 2022
STATUS
approved