login
Largest prime p such that the sum of n consecutive primes plus p is equal to (n+1)^3.
1

%I #8 Jun 03 2013 14:05:55

%S 5,19,41,89,163,271,19,631,677,1103,1237,1879,2053,3049,3299,4229,

%T 5333,5857,7219,7607,9859,11117,12577,14173,16417,16223,20477,22679,

%U 25409,26833,30509,32771,36887,39989,43759,47911,52127,56237,60013,65657,69691,74887

%N Largest prime p such that the sum of n consecutive primes plus p is equal to (n+1)^3.

%C Does a(n) exist for each n? - _Charles R Greathouse IV_, Jun 03 2013

%H Charles R Greathouse IV, <a href="/A100572/b100572.txt">Table of n, a(n) for n = 1..10000</a>

%e a(2)=19 because 3+5+19=3^3;

%e a(3)=41 because 5+7+11+41=4^3;

%e a(4)=89 because 5+7+11+13+89=5^3.

%o (PARI) a(n)=if(n==1,return(5)); my(v=primes(n),s=sum(i=1,n,v[i]),N=(n+1)^3);forprime(p=v[#v]+1,N,if(isprime(N-s),return(N-s));if(N<s,return(-1));s+=p-v[1];v=concat(v[2..n],p)) \\ _Charles R Greathouse IV_, Jun 03 2013

%K nonn

%O 1,1

%A _Giovanni Teofilatto_, Nov 29 2004

%E a(7) inserted, a(9)-a(42) from _Charles R Greathouse IV_, Jun 03 2013