cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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

Views

Author

Gage Schacher, Aug 04 2020

Keywords

Examples

			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.
		

Crossrefs

Cf. A000120 (binary weight), A326889.

Programs

  • 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 *)
  • 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

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).

Extensions

a(1)=1 added to definition. - N. J. A. Sloane, Sep 21 2020