OFFSET
1,2
COMMENTS
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
FORMULA
a(n) >= n^(1/3). - Charles R Greathouse IV, Oct 14 2022
EXAMPLE
For n = 12 we have divisors 1, 2, 3, 4, 6, 12; 1 occurs earlier once, 2 occurs earlier twice, 3 occurs earlier 3 times, but 4 occurs earlier only once, hence a(12) = 4.
MATHEMATICA
nn = 120; c[_] = 0; Do[k = SelectFirst[Divisors[n], c[#] < # &]; a[n] = k; c[k]++, {n, nn}]; Array[a, nn] (* Michael De Vlieger, Oct 14 2022 *)
PROG
(PARI) {m=83; v=vector(m); for(n=1, m, d=divisors(n); j=1; while(v[d[j]]>=d[j], j++); print1(d[j], ", "); v[d[j]]=v[d[j]]+1)}
(Python)
from sympy import divisors
from collections import Counter
from itertools import count, islice
def agen():
c = Counter()
for n in count(1):
an = next(d for d in divisors(n) if c[d] < d)
c[an] += 1
yield an
print(list(islice(agen(), 83))) # Michael S. Branicky, Oct 14 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Jun 01 2004
EXTENSIONS
Edited and extended by Klaus Brockhaus Jun 05 2004 and Jun 09 2004
STATUS
approved