login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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).
3
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,4
COMMENTS
The variant where the least significant bit has position 1 corresponds to A096111 (with an appropriate offset).
LINKS
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.
EXAMPLE
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
MATHEMATICA
A306286[n_] := Times @@ Flatten[Position[IntegerDigits[n, 2], 1]];
Array[A306286, 100, 0] (* Paolo Xausa, Jun 01 2024 *)
PROG
(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
CROSSREFS
Cf. A096111, A306549, A307218 (fixed points).
Sequence in context: A339612 A075257 A260618 * A226651 A073711 A071690
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, May 04 2019
STATUS
approved