A242517
List of primes p for which p^n - 2 is prime for n = 1, 3, and 5.
Original entry on oeis.org
31, 619, 2791, 4801, 15331, 33829, 40129, 63421, 69151, 98731, 127291, 142789, 143569, 149971, 151849, 176599, 184969, 201829, 210601, 225289, 231841, 243589, 250951, 271279, 273271, 277549, 280591, 392269, 405439, 441799, 472711, 510709, 530599, 568441, 578689
Offset: 1
31 is in the sequence because
p = 31 (prime),
p - 2 = 29 (prime),
p^3 - 2 = 29789 (prime), and
p^5 - 2 = 28629149 (prime).
-
Select[Range[600000], PrimeQ[#] && AllTrue[#^{1, 3, 5} - 2, PrimeQ] &] (* Amiram Eldar, Apr 06 2020 *)
-
isok(p) = isprime(p) && isprime(p-2) && isprime(p^3-2) && isprime(p^5-2); \\ Michel Marcus, Apr 06 2020
-
list(lim)=my(v=List(),p=29); forprime(q=31,lim, if(q-p==2 && isprime(q^3-2) && isprime(q^5-2), listput(v,q)); p=q); Vec(v) \\ Charles R Greathouse IV, Apr 06 2020
-
import sympy
n=2
while n>1:
n1=n-2
n2=((n**3)-2)
n3=((n**5)-2)
##Check if n1, n2 and n3 are also primes.
if sympy.ntheory.isprime(n1)== True and sympy.ntheory.isprime(n2)== True and sympy.ntheory.isprime(n3)== True:
print(n, " , " , n1, " , ", n2, " , ", n3)
n=sympy.ntheory.nextprime(n)
A242518
Primes p for which p^n - 2 is prime for n = 1, 3, 5 and 7.
Original entry on oeis.org
201829, 2739721, 6108679, 7883329, 9260131, 9309721, 9917389, 14488249, 15386491, 15876481, 16685299, 16967191, 18145279, 20566969, 20869129, 21150991, 23194909, 25510189, 28406929, 34669909, 35039311, 36795169, 37912141, 39083521, 39805639
Offset: 1
p = 201829 (prime)
p - 2 = 201827 (prime)
p^3 - 2 = 8221493263045787 (prime)
p^5 - 2 = 334902077869420623790640147 (prime)
p^7 - 2 = 13642217803107967058507788317851080907 (prime)
-
Select[Prime[Range[25*10^5]],AllTrue[#^{1,3,5,7}-2,PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Dec 26 2015 *)
-
import sympy
n=2
while n>1:
n1=n-2
n2=((n**3)-2)
n3=((n**5)-2)
n4=((n**7)-2)
##.Check if n1, n2, n3 and n4 are also primes
if sympy.ntheory.isprime(n1)== True and sympy.ntheory.isprime(n2)== True and sympy.ntheory.isprime(n3)== True and sympy.ntheory.isprime(n4)== True:
print(n, " , " , n1, " , ", n2, " , ", n3, " , ", n4)
n=sympy.ntheory.nextprime(n)
A243269
Smallest prime p such that p^k - 2 is prime for all odd exponents k from 1 up to 2*n-1 (inclusive).
Original entry on oeis.org
5, 19, 31, 201829, 131681731, 954667531, 8998333416049
Offset: 1
For n = 1, p = 5, p - 2 = 3 is prime.
For n = 2, p = 19, p - 2 = 17 and p^3 - 2 = 6857 are primes.
For n = 3, p = 31, p - 2 = 29, p^3 - 2 = 29789, and p^5 - 2 = 28629149 are primes.
-
import sympy
## isp_list returns an array of true/false for prime number test for a
## list of numbers
def isp_list(ls):
pt=[]
for a in ls:
if sympy.ntheory.isprime(a)==True:
pt.append(True)
return(pt)
co=1
while co < 7:
al=0
n=2
while al!=co:
d=[]
for i in range(0, co):
d.append(int(n**((2*i)+1))-2)
al=isp_list(d).count(True)
if al==co:
## Prints prime number and its corresponding sequence d
print(n, d)
n=sympy.ntheory.nextprime(n)
co=co+1
Showing 1-3 of 3 results.
Comments