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.

A191558 a(n) = 0 if n prime, otherwise n.

Original entry on oeis.org

1, 0, 0, 4, 0, 6, 0, 8, 9, 10, 0, 12, 0, 14, 15, 16, 0, 18, 0, 20, 21, 22, 0, 24, 25, 26, 27, 28, 0, 30, 0, 32, 33, 34, 35, 36, 0, 38, 39, 40, 0, 42, 0, 44, 45, 46, 0, 48, 49, 50, 51, 52, 0, 54, 55, 56, 57, 58, 0, 60, 0, 62, 63, 64, 65, 66, 0, 68, 69, 70, 0, 72, 0, 74, 75, 76, 77, 78, 0, 80, 81, 82, 0, 84, 85, 86, 87, 88, 0, 90, 91, 92, 93, 94
Offset: 1

Views

Author

Vincenzo Librandi, Jun 07 2011

Keywords

Crossrefs

Cf. A002808.

Programs

  • Magma
    [IsPrime(n) select 0 else n: n in [1..100]]; // Vincenzo Librandi, May 17 2014
  • Maple
    A191558 := proc(n) if isprime(n) then 0; else n; end if; end proc:
    seq(A191558(n),n=1..80) ; # R. J. Mathar, Jun 11 2011
  • Mathematica
    Table[If[PrimeQ[n], 0, n], {n, 150}] (* Vincenzo Librandi, May 17 2014 *)
    (*recurrence*)
    Clear[t];
    nn = 94;
    t[1, 1] = 1;
    t[n_, k_] :=
      t[n, k] =
       If[n == k, n*(1 - Product[t[n, k - i], {i, 1, k - 1}]),
        If[n > k, t[n - k, k], 1]];
    Table[t[n, n], {n, 1, nn}](* Mats Granvik, Jul 05 2014 *)
    Table[n (1 - PrimePi[n] + PrimePi[n - 1]), {n, 50}] (* Wesley Ivan Hurt, Jul 06 2014 *)

Formula

a(n) = n * A005171(n) = n - A061397(n). - R. J. Mathar, Jun 11 2011