login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

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

%I #11 Jul 31 2015 02:33:22

%S 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,

%T 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,

%U 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

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

%e 1^2 - 1 + 1 = 1, which is not prime, so a(1)=0;

%e 2^2 - 2 + 1 = 3, which is prime, so a(2)=3;

%e 3^3 - 3 + 1 = 7, which is prime, so a(3)=7.

%t 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 *)

%o (PARI) vector(80, n, if (isprime(p=n^2-n+1), p, 0)) \\ _Michel Marcus_, Jul 31 2015

%Y Cf. A002061, A002383, A002384.

%K easy,nonn

%O 1,2

%A _Pierre CAMI_, Jun 06 2005

%E More terms from _Robert G. Wilson v_, Jun 07 2005