Prime Search 3^n – n + 1

I’ve started sieving the prime numbers of the form:

I’ve also submitted the sequence to OEIS with the number A308829. The last value I’ve found is:

The numbers are very small if compared to the last Mersenne or GFN primes found, but I’m confident to overcome a million digits very soon. The sieving process is quite slow but it can be limited to odd values of n because, if n is even:

The sieving program I’ve written is obviously in C++ and it’s currently based on GMP and Intel TBB®, but I’m working to improve the performances every day. The following ones are snippets in common mathematical languages to find the first terms of the sequence:

Mathematica® snippet

a[k_] := Block[{seq = {}, n = 0, i = 0}, While[Length[seq] < 
               k, {n = 3^i - i + 1, If[PrimeQ[n], AppendTo[seq, i]], i += 1}]; seq]

Sage snippet

def list_a(k): 
return [i for i in range(k) if (3**i) - i + 1 in Primes()]

PARI snippet

a(k) = isprime(3^k - k + 1); \\ Jinyuan Wang, Aug 03 2019

Length of the primes

Full list of found primes

Help needed!

If you want to help me in the research of the primes, please send me a private message. You can also make a donation through Paypal to support all the monthly expenses for the servers.