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.

Original entry on oeis.org

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, 69, 93, 91, 131, 77, 134, 142, 133, 105, 139, 143, 141, 265, 154, 195, 366, 201, 266, 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
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A332809 (a left inverse).

Programs

  • 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 *)
  • 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

Formula

A332809(a(n)) = n.