cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A333786 a(n) is the first occurrence of n in A332809.

This page as a plain text file.
%I A333786 #67 Sep 30 2022 07:51:19
%S A333786 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 A333786 69,93,91,131,77,134,142,133,105,139,143,141,265,154,195,366,201,266,
%U A333786 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 A333786 a(n) is the first occurrence of n in A332809.
%H A333786 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 A333786 A332809(a(n)) = n.
%t A333786 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 A333786 (PARI)
%o A333786 search_up_to = 20000;
%o A333786 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 A333786 v332809 = A332809list(search_up_to);
%o A333786 A332809(n) = v332809[n];
%o A333786 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 A333786 v333786 = A333786list(search_up_to);
%o A333786 A333786(n) = v333786[n]; \\ _Antti Karttunen_, May 09 2020
%o A333786 (Python)
%o A333786 from sympy import factorint
%o A333786 from functools import cache
%o A333786 from itertools import count, islice
%o A333786 @cache
%o A333786 def b(n): return {n}.union(*(b(n - n//p) for p in factorint(n)))
%o A333786 def A332809(n): return len(b(n))
%o A333786 def agen():
%o A333786     adict, n = dict(), 1
%o A333786     for k in count(1):
%o A333786         v = A332809(k)
%o A333786         if v not in adict: adict[v] = k
%o A333786         while n in adict: yield adict[n]; n += 1
%o A333786 print(list(islice(agen(), 70))) # _Michael S. Branicky_, Aug 13 2022
%Y A333786 Cf. A332809 (a left inverse).
%K A333786 nonn
%O A333786 1,2
%A A333786 _Michael De Vlieger_, _Peter Kagey_, _Antti Karttunen_, _Robert G. Wilson v_, May 09 2020