login
A175094
a(1) = 1, a(2) = 3, for n >= 3, a(n) = smallest prime > a(n-1) such that a(n) mod a(n-1) = a(n-2).
3
1, 3, 7, 17, 41, 181, 1489, 18049, 218077, 1326511, 69196649, 3045979067, 67080736123, 942176284789, 15141901292747, 31225978870283, 577209520957841, 9266578314195739, 575105065001093659, 5760317228325132329, 104260815174853475581, 3967671293872757204407
OFFSET
1,2
COMMENTS
a(390) has 1001 digits. - Michael S. Branicky, Dec 21 2023
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..389
MATHEMATICA
nmax= 13; a[1]=1; a[2]=3; kmin=1; For[n=3, n<=nmax, n++, For[k=kmin, k>0, k++, If[Mod[Prime[k], a[n-1]]==a[n-2], a[n]=Prime[k]; kmin=k; k=-1]]]; Array[a, nmax] (* Stefano Spezia, Sep 16 2022 *)
PROG
(Python)
from gmpy2 import is_prime
from itertools import count, islice
def agen(): # generator of terms
c, b = 1, 3
yield from [c, b]
for n in count(3):
a = next(c + b*i for i in count(1) if is_prime(c+b*i))
c, b = b, a
yield a
print(list(islice(agen(), 22))) # Michael S. Branicky, Dec 21 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Jaroslav Krizek, Jan 31 2010
EXTENSIONS
Definition corrected by Stefano Spezia, Sep 16 2022
a(14) and beyond from Michael S. Branicky, Dec 21 2023
STATUS
approved