OFFSET
1,1
COMMENTS
a(n) is the least prime == 1 mod (6*n) and (for n >= 2) greater than a(n-1).
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(5) = 151 because 151 is prime, 151-1 = 150 is divisible by 6*5, and 151 > a(4) = 73.
MAPLE
A:= Vector(100):
A[1]:= 7:
for n from 2 to 100 do
for k from floor((A[n-1]-1)/(6*n))+1 do
p:= 6*n*k+1;
if isprime(p) then A[n]:= p; break fi
od od:
convert(A, list);
MATHEMATICA
a[n_] := a[n] = Module[{p = If[n == 1, 2, NextPrime[a[n - 1]]]}, While[!Divisible[p - 1, 6*n], p = NextPrime[p]]; p]; Array[a, 50] (* Amiram Eldar, Jun 29 2022 *)
PROG
(Python)
from itertools import count, islice
from sympy import nextprime
def A355329_gen(): # generator of terms
p = 2
for m in count(6, 6):
while q:=(p-1)%m:
p = nextprime(p+m-q-1)
yield p
p = nextprime(p)
CROSSREFS
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Jun 29 2022
STATUS
approved