OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..2500
EXAMPLE
a(3) = 137 is a term because 137, 139, 149 are consecutive primes and
137^1 + 139^1 - 149^1 = 127,
137^2 + 139^2 - 149^2 = 15889,
and 137^3 + 139^3 - 149^3 = 1949023 are all prime.
MAPLE
R:= NULL: count:= 0: q:= 2: r:= 3:
while count < 100 do
p:= q; q:= r; r:=nextprime(r);
if isprime(p+q-r) and isprime(p^2+q^2-r^2) and isprime(p^3+q^3-r^3) then count:= count+1; R:= R, p fi;
od:
R;
MATHEMATICA
Select[Partition[Prime[Range[13000]], 3, 1], AllTrue[Table[#[[1]]^k + #[[2]]^k - #[[3]]^k, {k, 1, 3}], PrimeQ] &][[;; , 1]] (* Amiram Eldar, Nov 29 2022 *)
PROG
(Python)
from itertools import islice
from sympy import isprime, nextprime
def agen():
p, q, r = 2, 3, 5
while True:
if all(isprime(t) for t in [p+q-r, p**2+q**2-r**2, p**3+q**3-r**3]):
yield p
p, q, r = q, r, nextprime(r)
print(list(islice(agen(), 44))) # Michael S. Branicky, Nov 29 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Nov 29 2022
STATUS
approved