login
A108154
a(n) = n^2 - n + 1 if prime else 0.
0
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,2
EXAMPLE
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.
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 *)
PROG
(PARI) vector(80, n, if (isprime(p=n^2-n+1), p, 0)) \\ Michel Marcus, Jul 31 2015
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Pierre CAMI, Jun 06 2005
EXTENSIONS
More terms from Robert G. Wilson v, Jun 07 2005
STATUS
approved