OFFSET
1,2
COMMENTS
Equivalently, number of distinct primes of the form x^2 - x + prime(n) for 0 <= x <= prime(n). (The point is that x^2 + x = (x+1)^2 - (x+1), so the two forms give the same numbers. x^2 - x + prime(n) is the same for x=0 and x=1, which is why the "distinct" in the comment. - Robert Israel, Oct 09 2016)
1 <= a(n) <= prime(n)-1. a(n) = prime(n)-1 iff n is in A014556. Are there any n > 1 such that a(n) = 1? - Robert Israel, Jan 16 2015
LINKS
Michel Lagneau, Table of n, a(n) for n = 1..4000
Eric Weisstein's World of Mathematics, Lucky Number of Euler
EXAMPLE
a(13) = 40 because prime(13) = 41 and x^2 + x + 41 generates 40 prime numbers for x = 0..41.
MAPLE
f:= proc(n)
local p, x;
p:= ithprime(n);
nops(select(isprime, [seq(x^2+x+p, x=0..p)]))
end proc:
seq(f(n), n=1..100); # Robert Israel, Jan 16 2015
MATHEMATICA
lst={}; Do[p=Prime[n]; k=0; Do[If[PrimeQ[x^2+x+p], k=k+1], {x, 0, p}]; AppendTo[lst, k], {n, 1, 100}]; lst
Table[With[{p=Prime[n]}, Count[Table[x^2+x+p, {x, 0, p}], _?PrimeQ]], {n, 70}] (* Harvey P. Dale, May 27 2018 *)
PROG
(PARI) a(n) = my(p=prime(n)); sum(k=0, p, isprime(subst(x^2+x+p, x, k))); \\ Michel Marcus, Jan 16 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Jan 16 2015
STATUS
approved