login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A358742 First of three consecutive primes p,q,r such that p^3 + q^3 - r^3 is prime. 4

%I #18 Nov 29 2022 13:28:47

%S 13,29,89,97,127,137,151,163,199,223,241,277,313,349,367,389,419,431,

%T 457,463,521,577,613,691,823,827,829,859,877,883,911,953,971,1049,

%U 1087,1097,1129,1151,1163,1217,1409,1489,1499,1579,1699,1723,1867,1879,1993,2089,2111,2141,2293,2339,2399,2411

%N First of three consecutive primes p,q,r such that p^3 + q^3 - r^3 is prime.

%C Note: for x >= 3275, there is a prime between x and x(1 + 1/(2 log^2 x)) < 1.01x (Dusart 1998). Together with finite checking this shows that for p > 19, p^3 + q^3 - r^3 > 0. - _Charles R Greathouse IV_, Nov 29 2022

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

%e a(3) = 89 is a term because 89, 97, 101 are consecutive primes and 89^3 + 97^3 - 101^3 = 587341 is prime.

%p R:= NULL: count:= 0: q:= 2: r:= 3:

%p while count < 100 do

%p p:= q; q:= r; r:=nextprime(r);

%p if isprime(p^3+q^3-r^3) then count:= count+1; R:= R,p; fi;

%p od:

%p R;

%t Select[Partition[Prime[Range[360]], 3, 1], (s = #[[1]]^3 + #[[2]]^3 - #[[3]]^3) > 0 && PrimeQ[s] &][[;; , 1]] (* _Amiram Eldar_, Nov 29 2022 *)

%o (Python)

%o from itertools import islice

%o from sympy import isprime, nextprime

%o def agen():

%o p, q, r = 2, 3, 5

%o while True:

%o if isprime(p**3 + q**3 - r**3): yield p

%o p, q, r = q, r, nextprime(r)

%o print(list(islice(agen(), 56))) # _Michael S. Branicky_, Nov 29 2022

%o (PARI) a358742(upto) = {my(p1=2, p2=3); forprime(p3=5, upto, if (isprime (p1^3+p2^3-p3^3), print1(p1,", ")); p1=p2; p2=p3)};

%o a358742(2500) \\ _Hugo Pfoertner_, Nov 29 2022

%Y Cf. A255581, A358743, A358744.

%K nonn

%O 1,1

%A _J. M. Bergot_ and _Robert Israel_, Nov 29 2022

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 19 23:12 EDT 2024. Contains 375310 sequences. (Running on oeis4.)