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.

A151787 a(1)=1; for n > 1, a(n)=3*2^{wt(n-1)-1}.

Original entry on oeis.org

1, 3, 3, 6, 3, 6, 6, 12, 3, 6, 6, 12, 6, 12, 12, 24, 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48, 6, 12, 12, 24, 12, 24, 24, 48, 12, 24, 24, 48, 24, 48, 48, 96, 3, 6, 6, 12, 6, 12, 12, 24, 6, 12, 12, 24, 12, 24, 24, 48
Offset: 1

Views

Author

N. J. A. Sloane, Jun 25 2009

Keywords

Comments

wt(n) is the Hamming weight = binary weight of n (A000120).

Crossrefs

Programs

  • Maple
    wt:= n -> convert(convert(n,base,2),`+`):
    [1, seq(3*2^(wt(n-1)-1),n=2..100)]; # Robert Israel, Feb 27 2018
  • Mathematica
    a[n_] := If[n == 1, 1, 3*2^(Total[IntegerDigits[n-1, 2]]-1)];
    Array[a, 100] (* Jean-François Alcover, Mar 27 2019 *)
  • PARI
    a(n) = if (n==1, 1, 3*2^(hammingweight(n-1)-1)); \\ Michel Marcus, Feb 27 2018

Formula

From Robert Israel, Feb 27 2018: (Start)
For n > 1, a(2*n)=2*a(n).
a(2*n+1)=a(n+1).
G.f. g(x) satisfies g(x) = (2+1/x)*g(x^2) + x^2. (End)
a(n) = 3*A001316(n-1)/2 for n >= 2. - Georg Fischer, Jun 23 2021

Extensions

Definition corrected by Omar E. Pol, Mar 03 2015