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.

A108154 a(n) = n^2 - n + 1 if prime else 0.

Original entry on oeis.org

0, 3, 7, 13, 0, 31, 43, 0, 73, 0, 0, 0, 157, 0, 211, 241, 0, 307, 0, 0, 421, 463, 0, 0, 601, 0, 0, 757, 0, 0, 0, 0, 0, 1123, 0, 0, 0, 0, 1483, 0, 0, 1723, 0, 0, 0, 0, 0, 0, 0, 0, 2551, 0, 0, 0, 2971, 0, 0, 3307, 0, 3541, 0, 0, 3907, 0, 0, 0, 4423, 0, 0, 4831, 0, 5113, 0, 0, 0, 5701, 0
Offset: 1

Views

Author

Pierre CAMI, Jun 06 2005

Keywords

Examples

			1^2 - 1 + 1 = 1, which is not prime, so a(1)=0;
2^2 - 2 + 1 = 3, which is prime, so a(2)=3;
3^3 - 3 + 1 = 7, which is prime, so a(3)=7.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{p = n^2 - n + 1}, If[ PrimeQ[p], p, 0]]; Table[ f[n], {n, 77}] (* Robert G. Wilson v, Jun 07 2005 *)
  • PARI
    vector(80, n, if (isprime(p=n^2-n+1), p, 0)) \\ Michel Marcus, Jul 31 2015

Extensions

More terms from Robert G. Wilson v, Jun 07 2005