|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
|
|
LINKS
|
|
|
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|