login
Primes p(n) such that p(n) + p(n+3) = p(n+1) + p(n+2) and p(n) + p(n+4) = p(n+2) + p(n+3).
0

%I #19 Aug 31 2017 14:24:26

%S 13,37,223,1087,1423,1483,2683,4783,6079,7331,7547,11057,12269,12401,

%T 12641,17333,19471,20743,21799,23027,27733,28097,29017,29389,30631,

%U 30859,33191,33343,33587,33613,35527,36551,42457,44263,45817,48857,49459,54499,55813,57329,58151,59207

%N Primes p(n) such that p(n) + p(n+3) = p(n+1) + p(n+2) and p(n) + p(n+4) = p(n+2) + p(n+3).

%C All terms = {1, 5} mod 6. - _Muniru A Asiru_, Aug 19 2017

%e Starting from 13, the five consecutive primes are 13, 17, 19, 23, 29; and they satisfy 13 + 23 = 17 + 19 and 13 + 29 = 23 + 19. So 13 is in the sequence.

%p for i from 1 to 10^5 do if ithprime(i)+ithprime(i+3) = ithprime(i+1)+ithprime(i+2) and ithprime(i)+ithprime(i+4) = ithprime(i+2)+ithprime(i+3) then print(ithprime(i)); fi; od; # _Muniru A Asiru_, Aug 19 2017

%t Prime@ Select[Range@ 6000, And[Prime@ # + Prime[# + 3] == Prime[# + 1] + Prime[# + 2], Prime@ # + Prime[# + 4] == Prime[# + 2] + Prime[# + 3]] &] (* _Michael De Vlieger_, Jan 05 2016 *)

%o (Python)

%o from sympy import primerange

%o b, c, d, e = 2, 3, 5, 7

%o for p in primerange(11, 10**9):

%o ... a, b, c, d, e = b, c, d, e, p

%o ... if a + d == b + c and a + e == c + d:

%o ....... print a

%o (PARI) lista(nn) = {for (n=1, nn, if ((prime(n) + prime(n+3) == prime(n+1) + prime(n+2)) && (prime(n) + prime(n+4) == prime(n+2) + prime(n+3)), print1(prime(n), ", ")););} \\ _Michel Marcus_, Jan 05 2016

%o (GAP)

%o K:=10^7+1;; # to get all terms <= K.

%o P:=Filtered([1,3..K],IsPrime);;

%o A:=[];; for n in [1..Length(P)-4] do if P[n]+P[n+3]=P[n+1]+P[n+2] and P[n]+P[n+4]=P[n+2]+P[n+3] then Add(A,P[n]); fi; od; A; # _Muniru A Asiru_, Aug 19 2017

%Y Subsequence of A022885.

%K nonn

%O 1,1

%A _Emmanuel Antonio José García_, Jan 05 2016

%E More terms from _Michel Marcus_, Jan 05 2016