%I #67 Sep 30 2022 07:51:19
%S 1,2,3,5,6,7,11,13,14,15,23,21,29,30,31,47,33,35,61,62,75,65,66,67,71,
%T 69,93,91,131,77,134,142,133,105,139,143,141,265,154,195,366,201,266,
%U 210,161,209,213,215,355,217,335,377,299,315,319,231,322,403,419,417,431,585,329,435,429,497,638,437,631,795
%N a(n) is the first occurrence of n in A332809.
%H Robert G. Wilson v, <a href="/A333786/b333786.txt">Table of n, a(n) for n = 1..15966</a> (first 1000 terms from Peter Kagey)
%F A332809(a(n)) = n.
%t 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 *)
%o (PARI)
%o search_up_to = 20000;
%o 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); }
%o v332809 = A332809list(search_up_to);
%o A332809(n) = v332809[n];
%o 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))); };
%o v333786 = A333786list(search_up_to);
%o A333786(n) = v333786[n]; \\ _Antti Karttunen_, May 09 2020
%o (Python)
%o from sympy import factorint
%o from functools import cache
%o from itertools import count, islice
%o @cache
%o def b(n): return {n}.union(*(b(n - n//p) for p in factorint(n)))
%o def A332809(n): return len(b(n))
%o def agen():
%o adict, n = dict(), 1
%o for k in count(1):
%o v = A332809(k)
%o if v not in adict: adict[v] = k
%o while n in adict: yield adict[n]; n += 1
%o print(list(islice(agen(), 70))) # _Michael S. Branicky_, Aug 13 2022
%Y Cf. A332809 (a left inverse).
%K nonn
%O 1,2
%A _Michael De Vlieger_, _Peter Kagey_, _Antti Karttunen_, _Robert G. Wilson v_, May 09 2020