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.

A151904 a(n) = (3^(wt(k)+f(j))-1)/2 if n = 6k+j, 0 <= j < 6, where wt = A000120, f = A151899.

Original entry on oeis.org

0, 0, 1, 1, 1, 4, 1, 1, 4, 4, 4, 13, 1, 1, 4, 4, 4, 13, 4, 4, 13, 13, 13, 40, 1, 1, 4, 4, 4, 13, 4, 4, 13, 13, 13, 40, 4, 4, 13, 13, 13, 40, 13, 13, 40, 40, 40, 121, 1, 1, 4, 4, 4, 13, 4, 4, 13, 13, 13, 40, 4, 4, 13, 13, 13, 40, 13, 13, 40, 40, 40, 121, 4, 4, 13, 13, 13, 40, 13, 13, 40, 40, 40
Offset: 0

Views

Author

N. J. A. Sloane, Jul 31 2009

Keywords

Crossrefs

Programs

  • Maple
    f := proc(n) local j; j:=n mod 6; if (j<=1) then 0 elif (j<=4) then 1 else 2; fi; end;
    wt := proc(n) local w,m,i; w := 0; m := n; while m > 0 do i := m mod 2; w := w+i; m := (m-i)/2; od; w; end;
    A151904 := proc(n) local k,j; k:=floor(n/6); j:=n-6*k; (3^(wt(k)+f(j))-1)/2; end;
  • Mathematica
    wt[n_] := DigitCount[n, 2, 1];
    f[n_] := {0, 0, 1, 1, 1, 2}[[Mod[n, 6] + 1]];
    A151902[n_] := wt[Floor[n/6]] + f[n - 6 Floor[n/6]];
    a[n_] := (3^A151902[n] - 1)/2;
    Table[a[n], {n, 0, 82}] (* Jean-François Alcover, Feb 16 2023 *)
  • PARI
    a(n)=(3^(hammingweight(n\6)+[0,0,1,1,1,2][n%6+1])-1)/2 \\ Charles R Greathouse IV, Sep 26 2015

Formula

a(n) = (3^A151902(n)-1)/2.