OFFSET
1,4
COMMENTS
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = 1 + A279119(n). - Rémy Sigrist, Mar 04 2024
EXAMPLE
a(4)=2 because if we had a(4)=1, then i=2 and i=4, which are not coprime indices, would have the same value 1. So a(4)=2, which is a first occurrence.
a(9)=2 because if we had a(9)=1, i=3 and i=9, would have the same value despite not being coprime indices. a(9) can be 2 because the only other index with a 2 is a(4)=2 and 4 is coprime to 9.
a(15)=4 because 4 is the smallest value such that every previous index at which a 4 occurs is coprime to i=15. In this case, 4 has only occurred at i=8 and 8 is coprime to 15.
PROG
(Python)
from math import gcd, lcm
from itertools import combinations as C, count, islice
def agen(): # generator of terms
yield from [1, 1, 1]
lcms = {1: 6}
for n in count(4):
an = next(an for an in count(1) if an not in lcms or gcd(lcms[an], n) == 1)
yield an
if an not in lcms: lcms[an] = n
else: lcms[an] = lcm(lcms[an], n)
print(list(islice(agen(), 75))) # Michael S. Branicky, Mar 02 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Neal Gersh Tolunsky, Mar 02 2024
EXTENSIONS
a(22) and beyond from Michael S. Branicky, Mar 02 2024
STATUS
approved