OFFSET
1,2
COMMENTS
Alternative definition: a(n) = smallest number > a(n-1) coprime with a(n-1)-1. Therefore, the sequence contains all prime numbers in ascending order.
Except for a(2), all terms are odd.
The sequence comprises the largest terms in A123882 appearing in order.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(14)=37 because a(13)=31, the smallest prime not a factor of 30 is p = 7, and 30+7 = 37.
MAPLE
f:= proc(k) local p;
p:= 2;
while k-1 mod p = 0 do p:= nextprime(p) od;
k-1+p
end proc:
A[1]:= 1: A[2]:= 2:
for n from 3 to 100 do A[n]:= f(A[n-1]) od:
seq(A[i], i=1..100); # Robert Israel, Oct 23 2018
PROG
(PARI) p(n)=pp=1; while(n%prime(pp)==0, pp++); prime(pp);
first(m)=my(v=vector(m)); v[1]=1; v[2]=2; for(i=3, m, v[i]=v[i-1]-1+p(v[i-1]-1)); v; /* Anders Hellström, Aug 13 2015 */
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Bob Selcoe, Aug 13 2015
STATUS
approved