A239147 Numbers n such that there exists a k>0 such that all six of n +/- k, n^2 +/- k, and n^3 +/- k are prime.
12, 25, 29, 36, 45, 55, 78, 87, 105, 109, 111, 130, 140, 141, 155, 160, 190, 196, 209, 216, 231, 245, 246, 265, 274, 280, 289, 294, 311, 315, 329, 356, 364, 385, 409, 441, 444, 465, 475, 489, 494, 531, 535, 572, 582, 600, 624, 629, 650, 665
Offset: 1
Keywords
Examples
n = 1,2,3,...11 do not have a k such that n +/- k, n^2 +/- k, and n^3 +/- k are all prime. However, for n = 12, 12 +/- 5 (7 and 17), 12^2 +/- 5 (139 and 149) and 12^3 +/- 5 (1723 and 1733) are all prime. So 12 is a member of this sequence.
Crossrefs
Cf. A239146.
Programs
-
Maple
isA239147 := proc(n) local k ; for k from 1 do if n-k <= 1 then return false; end if; if isprime(n+k) and isprime(n-k) and isprime(n^2+k) and isprime(n^2-k) and isprime(n^3+k) and isprime(n^3-k) then return true; end if; end do; end proc: for n from 1 to 800 do if isA239147(n) then printf("%d,",n) ; end if; end do: # R. J. Mathar, Mar 12 2014
-
Python
import sympy from sympy import isprime def c(n): for k in range(n): if isprime(n+k) and isprime(n-k) and isprime(n**2+k) and isprime(n**2-k) and isprime(n**3+k) and isprime(n**3-k): return k n = 1 while n < 10**3: if c(n) != None: print(n) n += 1
Comments