OFFSET
1,2
LINKS
Robert G. Wilson v, Table of n, a(n) for n = 1..15966 (first 1000 terms from Peter Kagey)
FORMULA
A332809(a(n)) = n.
MATHEMATICA
a[n_] := Block[{lst = {{n}}}, While[ lst[[-1]] != {1}, lst = Join[lst, {Union[ Flatten[# - #/(First@# & /@ FactorInteger@#) & /@ lst[[-1]]]]}]]; Length@Flatten@lst]; t[_] := 0; k = 1; While[k < 100001, b = a@k; If[ t[b] == 0, t[b] = k]; k++]; t@# & /@ Range@ 100 (* Robert G. Wilson v, May 08 2020 *)
PROG
(PARI)
search_up_to = 20000;
A332809list(up_to) = { my(v=vector(up_to)); v[1] = Set([1]); for(n=2, up_to, my(f=factor(n)[, 1]~, s=Set([n])); for(i=1, #f, s = setunion(s, v[n-(n/f[i])])); v[n] = s); apply(length, v); }
v332809 = A332809list(search_up_to);
A332809(n) = v332809[n];
A333786list(search_up_to) = { my(focs=Map(), t); for(n=1, search_up_to, t = A332809(n); if(!mapisdefined(focs, t), mapput(focs, t, n))); my(lista=List([]), v); for(u=1, oo, if(!mapisdefined(focs, u, &v), return(Vec(lista)), listput(lista, v))); };
v333786 = A333786list(search_up_to);
A333786(n) = v333786[n]; \\ Antti Karttunen, May 09 2020
(Python)
from sympy import factorint
from functools import cache
from itertools import count, islice
@cache
def b(n): return {n}.union(*(b(n - n//p) for p in factorint(n)))
def A332809(n): return len(b(n))
def agen():
adict, n = dict(), 1
for k in count(1):
v = A332809(k)
if v not in adict: adict[v] = k
while n in adict: yield adict[n]; n += 1
print(list(islice(agen(), 70))) # Michael S. Branicky, Aug 13 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved