OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(2) = 3 is a term because Sum_{i=1..3} i*prime(i) = 1*2 + 2*3 + 3*5 = 23 and Sum_{i=1..3} (4-i)*prime(i) = 3*2 + 2*3 + 1*5 = 17 are prime.
MAPLE
S1:= 2: S2:= 2: S3:= 2*S2-S1: R:= 1: count:= 1: p:= 2:
for n from 2 to 40000 do
p:= nextprime(p);
S1:= S1 + n*p;
S2:= S2 + p;
if n mod 4 = 3 and isprime(S1) then
S3:= (n+1)*S2 - S1;
if isprime(S3) then
count:= count+1; R:= R, n;
fi
fi;
od:
R;
MATHEMATICA
r = Range[35000]; p = Prime[r]; Intersection[Position[Accumulate[r*p], _?PrimeQ], Position[Accumulate[Accumulate[p]], _?PrimeQ]] // Flatten (* Amiram Eldar, Jul 28 2022 *)
PROG
(PARI) isok(k) = my(vp=primes(k)); isprime(sum(i=1, k, i*vp[i])) && isprime(sum(i=1, k, (k+1-i)*vp[i])); \\ Michel Marcus, Jul 29 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Jul 28 2022
STATUS
approved