login
A356419
Inverse of A067576 considered as a permutation of the positive integers.
3
1, 2, 3, 4, 5, 8, 6, 7, 12, 17, 9, 23, 13, 18, 10, 11, 30, 38, 24, 47, 31, 39, 14, 57, 48, 58, 19, 69, 25, 32, 15, 16, 68, 80, 81, 93, 94, 108, 40, 107, 123, 139, 49, 156, 59, 70, 20, 122, 174, 193, 82, 213, 95, 109, 26, 234, 124, 140, 33, 157, 41, 50, 21, 22, 138, 155, 256
OFFSET
1,2
FORMULA
Let w(n) = A000120(n) be the Hamming weight of n, p(n) = A068076(n), then a(n) = binomial(w(n)+p(n)+1, 2) - p(n).
EXAMPLE
A067576(12) = 9, so a(9) = 12.
PROG
(PARI) a(n)=my(w=hammingweight(n), p=sum(i=1, n-1, hammingweight(i)==w)); binomial(w+p+1, 2) - p
(Python)
from math import comb
def A356419(n):
c, k = 0, 0
for i, j in enumerate(bin(n)[-1:1:-1]):
if j == '1':
k += 1
c += comb(i, k)
return comb(n.bit_count()+c+1, 2)-c # Chai Wah Wu, Mar 02 2023
CROSSREFS
KEYWORD
nonn,look,easy
AUTHOR
Jianing Song, Aug 06 2022
STATUS
approved