OFFSET
1,2
COMMENTS
Includes all primes. - Robert Israel, Jun 17 2024
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(7) = 9 which is coprime to the three previous terms 5, 7 and 8.
MAPLE
R:= 1, 2: x:= 2:
for n from 3 to 100 do
t:= ilcm(R[ceil(n/2) .. n-1]);
for i from x+1 while igcd(i, t) <> 1 do od:
R:= R, i;
x:= i;
od:
R; # Robert Israel, Jun 23 2024
PROG
(Python)
from math import gcd, lcm
from itertools import count, islice
def agen(): # generator of terms
alst, an, LCM, = [1], 1, 1
for n in count(2):
yield an
LCM = lcm(*alst[-(n//2):])
an = next(k for k in count(an+1) if gcd(k, LCM) == 1)
alst.append(an)
print(list(islice(agen(), 62))) # Michael S. Branicky, Jun 25 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Aug 29 2003
EXTENSIONS
More terms from David Wasserman, Mar 21 2005
Definition and offset corrected by Robert Israel, Jun 17 2024
STATUS
approved