A306286 a(n) is the product of the positions of the ones in the binary expansion of n (the most significant bit having position 1).
1, 1, 1, 2, 1, 3, 2, 6, 1, 4, 3, 12, 2, 8, 6, 24, 1, 5, 4, 20, 3, 15, 12, 60, 2, 10, 8, 40, 6, 30, 24, 120, 1, 6, 5, 30, 4, 24, 20, 120, 3, 18, 15, 90, 12, 72, 60, 360, 2, 12, 10, 60, 8, 48, 40, 240, 6, 36, 30, 180, 24, 144, 120, 720, 1, 7, 6, 42, 5, 35, 30
Offset: 0
Examples
The first terms, alongside the positions of ones and the binary representation of n, are: n a(n) Pos. ones bin(n) -- ---- --------- ------ 0 1 {} 0 1 1 {1} 1 2 1 {1} 10 3 2 {1,2} 11 4 1 {1} 100 5 3 {1,3} 101 6 2 {1,2} 110 7 6 {1,2,3} 111 8 1 {1} 1000 9 4 {1,4} 1001 10 3 {1,3} 1010 11 12 {1,3,4} 1011 12 2 {1,2} 1100 13 8 {1,2,4} 1101 14 6 {1,2,3} 1110 15 24 {1,2,3,4} 1111 16 1 {1} 10000
Links
- Rémy Sigrist, Table of n, a(n) for n = 0..16384
Programs
-
Mathematica
A306286[n_] := Times @@ Flatten[Position[IntegerDigits[n, 2], 1]]; Array[A306286, 100, 0] (* Paolo Xausa, Jun 01 2024 *)
-
PARI
a(n) = my (b=binary(n)); prod(k=1, #b, if (b[k],k,1))
-
PARI
a(n) = vecprod(Vec(select(x->(x==1), binary(n), 1))); \\ Michel Marcus, Jun 01 2024
-
Python
from math import prod def a(n): return prod(i for i, bi in enumerate(bin(n)[2:], 1) if bi == "1") print([a(n) for n in range(71)]) # Michael S. Branicky, Jun 01 2024
Formula
a(2*n) = a(n).
a(2^k) = 1 for any k >= 0.
a(2^k-1) = k! for any k >= 0.
a(2^k+1) = k+1 for any k >= 0.
Comments