login
Numbers k such that both Sum_{i=1..k} i*prime(i) and Sum_{i=1..k} (k+1-i)*prime(i) are prime.
1

%I #13 Aug 03 2022 12:40:18

%S 1,3,199,351,1583,1955,2579,2627,3251,3407,3503,5311,6359,6819,7295,

%T 7547,8791,9663,10143,10591,11499,11579,12199,12443,14527,15563,15583,

%U 16051,16543,16655,18047,18319,20691,20847,23979,24079,24575,25667,26491,28235,30395,30627,32235,32259,33091,33287,33527

%N Numbers k such that both Sum_{i=1..k} i*prime(i) and Sum_{i=1..k} (k+1-i)*prime(i) are prime.

%C Numbers k such that A014148(k) and A014285(k) are both prime.

%C a(n) == 3 (mod 4) for n > 1.

%H Robert Israel, <a href="/A356178/b356178.txt">Table of n, a(n) for n = 1..10000</a>

%e 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.

%p S1:= 2: S2:= 2: S3:= 2*S2-S1: R:= 1: count:= 1: p:= 2:

%p for n from 2 to 40000 do

%p p:= nextprime(p);

%p S1:= S1 + n*p;

%p S2:= S2 + p;

%p if n mod 4 = 3 and isprime(S1) then

%p S3:= (n+1)*S2 - S1;

%p if isprime(S3) then

%p count:= count+1; R:= R, n;

%p fi

%p fi;

%p od:

%p R;

%t r = Range[35000]; p = Prime[r]; Intersection[Position[Accumulate[r*p], _?PrimeQ], Position[Accumulate[Accumulate[p]], _?PrimeQ]] // Flatten (* _Amiram Eldar_, Jul 28 2022 *)

%o (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

%Y Cf. A014148, A014285.

%K nonn

%O 1,2

%A _J. M. Bergot_ and _Robert Israel_, Jul 28 2022