A358744 First of three consecutive primes p, q, r such that p + q - r, p^2 + q^2 - r^2 and p^3 + q^3 - r^3 are all prime.
13, 29, 137, 521, 577, 691, 823, 1879, 3469, 4799, 8783, 21569, 25453, 26263, 26591, 27529, 27919, 34607, 39509, 45631, 48869, 53653, 56099, 56633, 57641, 63313, 63809, 67733, 68819, 74381, 76031, 76421, 94781, 97187, 98873, 101279, 105683, 110291, 118967, 119569, 119849, 120577, 123737, 128951
Offset: 1
Keywords
Examples
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.
Links
- Robert Israel, Table of n, a(n) for n = 1..2500
Programs
-
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 *)
-
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