%I #19 Aug 31 2020 02:42:23
%S 5,19,31,201829,131681731,954667531,8998333416049
%N Smallest prime p such that p^k - 2 is prime for all odd exponents k from 1 up to 2*n-1 (inclusive).
%C The first 4 entries of this sequence are the first entry of the following sequences:
%C A006512 : Primes p such that p - 2 is also prime.
%C A240126 : Primes p such that p - 2 and p^3 - 2 are also prime.
%C A242517 : Primes p such that p - 2, p^3 - 2 and p^5 - 2 are primes.
%C A242518 : Primes p such that p - 2, p^3 - 2, p^5 - 2 and p^7 - 2 are primes.
%e For n = 1, p = 5, p - 2 = 3 is prime.
%e For n = 2, p = 19, p - 2 = 17 and p^3 - 2 = 6857 are primes.
%e For n = 3, p = 31, p - 2 = 29, p^3 - 2 = 29789, and p^5 - 2 = 28629149 are primes.
%o (Python)
%o import sympy
%o ## isp_list returns an array of true/false for prime number test for a
%o ## list of numbers
%o def isp_list(ls):
%o ....pt=[]
%o ....for a in ls:
%o ........if sympy.ntheory.isprime(a)==True:
%o ............pt.append(True)
%o ....return(pt)
%o co=1
%o while co < 7:
%o ....al=0
%o ....n=2
%o ....while al!=co:
%o ........d=[]
%o ........for i in range(0, co):
%o ............d.append(int(n**((2*i)+1))-2)
%o ........al=isp_list(d).count(True)
%o ........if al==co:
%o ............## Prints prime number and its corresponding sequence d
%o ............print(n, d)
%o ........n=sympy.ntheory.nextprime(n)
%o ....co=co+1
%Y Cf. A006512, A240126, A242517 and A242518.
%K nonn,hard,more
%O 1,1
%A _Abhiram R Devesh_, Jun 02 2014
%E a(7) from _Bert Dobbelaere_, Aug 30 2020
|