login
A336823
a(1)=1; thereafter a(n) = a(n-1) / wt(n-1) if wt(n-1) divides a(n-1), otherwise a(n) = a(n-1) * wt(n-1) where wt(n) is the binary weight of n.
3
1, 1, 1, 2, 2, 1, 2, 6, 6, 3, 6, 2, 1, 3, 1, 4, 4, 2, 1, 3, 6, 2, 6, 24, 12, 4, 12, 3, 1, 4, 1, 5, 5, 10, 5, 15, 30, 10, 30, 120, 60, 20, 60, 15, 5, 20, 5, 1, 2, 6, 2, 8, 24, 6, 24, 120, 40, 10, 40, 8, 2, 10, 2, 12, 12, 6, 3, 1, 2, 6, 2, 8, 4, 12, 4, 1, 3, 12
OFFSET
1,4
LINKS
FORMULA
a(n) = a(n-1)/A000120(n-1) iff A000120(n-1) is a factor of a(n-1), otherwise a(n) = a(n-1)*A000120(n-1).
EXAMPLE
a(1)=1 is given, and has 1, the binary weight of 1, as a factor so a(2) =1/1=1;
a(2)=1 which has 1, the binary weight of 2, as a factor so a(3) =1/1=1;
a(3)=1 which does not have 2, the binary weight of 3, as a factor so a(4) =1*2=2.
MATHEMATICA
a[1] = 1; a[n_] := a[n] = If[Divisible[a[n-1], (w = DigitCount[n-1, 2, 1])], a[n-1] / w, a[n-1] * w]; Array[a, 100] (* Amiram Eldar, Aug 05 2020 *)
PROG
(PARI) a(n) = if (n==1, 1, my(h=hammingweight(n-1), last=a(n-1)); if (last%h, last*h, last/h)); \\ Michel Marcus, Aug 05 2020
CROSSREFS
Cf. A000120 (binary weight), A326889.
Sequence in context: A335190 A283170 A368836 * A375062 A236144 A226328
KEYWORD
base,nonn,look
AUTHOR
Gage Schacher, Aug 04 2020
EXTENSIONS
a(1)=1 added to definition. - N. J. A. Sloane, Sep 21 2020
STATUS
approved