OFFSET
1,4
LINKS
Gage Schacher, Table of n, a(n) for n = 1..10000
FORMULA
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
KEYWORD
AUTHOR
Gage Schacher, Aug 04 2020
EXTENSIONS
a(1)=1 added to definition. - N. J. A. Sloane, Sep 21 2020
STATUS
approved