login
a(n) is the number of primes of the form x^2 + x + prime(n) for 0 <= x <=prime(n).
2

%I #17 May 27 2018 13:26:18

%S 1,2,4,4,10,4,16,6,10,13,14,16,40,8,26,19,34,21,36,28,18,18,34,27,31,

%T 68,16,71,30,23,37,37,67,44,54,55,54,26,65,50,70,68,79,43,60,70,52,51,

%U 132,38,60,100,59,111,114,84,77,68,78,105,49,67,124,145,35

%N a(n) is the number of primes of the form x^2 + x + prime(n) for 0 <= x <=prime(n).

%C 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)

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

%H Michel Lagneau, <a href="/A253827/b253827.txt">Table of n, a(n) for n = 1..4000</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/LuckyNumberofEuler.html">Lucky Number of Euler</a>

%e a(13) = 40 because prime(13) = 41 and x^2 + x + 41 generates 40 prime numbers for x = 0..41.

%p f:= proc(n)

%p local p,x;

%p p:= ithprime(n);

%p nops(select(isprime, [seq(x^2+x+p,x=0..p)]))

%p end proc:

%p seq(f(n), n=1..100); # _Robert Israel_, Jan 16 2015

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

%t Table[With[{p=Prime[n]},Count[Table[x^2+x+p,{x,0,p}],_?PrimeQ]],{n,70}] (* _Harvey P. Dale_, May 27 2018 *)

%o (PARI) a(n) = my(p=prime(n)); sum(k=0, p, isprime(subst(x^2+x+p, x, k))); \\ _Michel Marcus_, Jan 16 2015

%Y Cf. A000040, A005846, A014556, A228123.

%K nonn

%O 1,2

%A _Michel Lagneau_, Jan 16 2015