login
A086539
Beginning with 1, a(n) = smallest number > a(n-1) and coprime to the k previous terms, where k = floor(n/2).
2
1, 2, 3, 5, 7, 8, 9, 11, 13, 17, 19, 23, 25, 28, 29, 31, 33, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 80, 83, 89, 91, 97, 101, 103, 107, 109, 111, 113, 121, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 230, 233
OFFSET
1,2
COMMENTS
Includes all primes. - Robert Israel, Jun 17 2024
LINKS
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
Sequence in context: A144100 A359059 A328320 * A171217 A344591 A049468
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