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.

Showing 1-10 of 11 results. Next

A365485 a(n) = A365399(10^n).

Original entry on oeis.org

1, 7, 39, 298, 2615, 23438, 225682, 2229674, 21903726
Offset: 0

Views

Author

Chai Wah Wu, Sep 05 2023

Keywords

Comments

a(n)/10^n appears to be decreasing. Conjecture: a(n)/10^n converges to a nonzero value.

Crossrefs

Programs

  • Python
    from bisect import bisect
    from sympy import divisor_count
    def A365485(n):
        m = 10**n
        plist, qlist, c = tuple(divisor_count(i) for i in range(1,m+1)), [0]*(m+1), 0
        for i in range(m):
            qlist[a:=bisect(qlist,plist[i],lo=1,hi=c+1,key=lambda x:plist[x])]=i
            c = max(c,a)
        return c

A365398 Length of the longest subsequence of 1, ..., n on which sigma, the sum of the divisors of n (A000203), is nondecreasing.

Original entry on oeis.org

1, 2, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 8, 9, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 21, 21, 21, 21, 22, 22, 22, 23, 24, 24, 25, 25, 25
Offset: 1

Views

Author

Peter Luschny, Sep 08 2023

Keywords

Comments

The sequence was inspired by A365339. In particular, note remark (4.4) by Terence Tao in the linked paper.

Crossrefs

Programs

  • Python
    from bisect import bisect
    from sympy import divisor_sigma
    def A365398(n):
        plist, qlist, c = tuple(divisor_sigma(i) for i in range(1,n+1)), [0]*(n+1), 0
        for i in range(n):
            qlist[a:=bisect(qlist,plist[i],lo=1,hi=c+1,key=lambda x:plist[x])]=i
            c = max(c,a)
        return c # Chai Wah Wu, Sep 08 2023

Formula

a(n+1) - a(n) <= 1.
a(n) >= A000720(n)+1 since A000203(p) = p+1 for p prime. - Chai Wah Wu, Sep 08 2023

A365339 Length of the longest subsequence of 1,...,n on which the Euler totient function phi A000010 is nondecreasing.

Original entry on oeis.org

1, 2, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 11, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 16, 16, 17, 17, 17, 17, 18, 18, 19, 19, 19, 19, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 27
Offset: 1

Views

Author

Terence Tao, Sep 01 2023

Keywords

Comments

a(n+1) is equal to a(n) or a(n) + 1 for every n.
It is conjectured that a(n) = pi(n) + 64 for all n >= 31957, which has been verified up to n = 10^7 (Pollack et al.), where pi is A000720. We always have a(n) >= pi(n).
Conjecture is true for n = 10^8 and n = 10^9. - Chai Wah Wu, Sep 05 2023

Examples

			a(6) = 5 because phi is nondecreasing on 1,2,3,4,5 or 1,2,3,4,6 but not on 1,2,3,4,5,6.
		

Crossrefs

Programs

  • Julia
    # Computes the first N terms of the sequence.
    function A365339List(N)
        phi = [i for i in 1:N + 1]
        for i in 2:N + 1
            if phi[i] == i
                for j in i:i:N + 1
                    phi[j] -= div(phi[j], i)
        end end end
        lst = zeros(Int64, N)
        dyn = zeros(Int64, N)
        for n in 1:N
            p = phi[n]
            nxt = dyn[p] + 1
            while p <= N && dyn[p] < nxt
                dyn[p] = nxt
                p += 1
            end
            lst[n] = dyn[n]
        end
        return lst
    end
    println(A365339List(69))  # Peter Luschny, Sep 02 2023
  • Mathematica
    Table[Length[LongestOrderedSequence[Table[EulerPhi[i],{i,n}]]], {n,100}]
  • Python
    import math
    def phi(n):
        result = n
        for i in range(2, math.isqrt(n) + 1):
            if n % i == 0:
                while n % i == 0:
                    n //= i
                result -= result // i
        if n > 1:
            result -= result // n
        return result
    # This code uses dynamic programming to print the first N=100 values of M.
    N=100
    M = [0 for i in range(N)]
    dynamic = [0 for i in range(N+1)]
    for n in range(1,N+1):
        i = phi(n)
        new = dynamic[i] + 1
        while (i<=N and dynamic[i] < new):
            dynamic[i] = new
            i+= 1
        M[n-1] = dynamic[N]
    print(M)
    
  • Python
    from bisect import bisect
    from sympy import totient
    def A365339(n):
        plist, qlist, c = tuple(totient(i) for i in range(1,n+1)), [0]*(n+1), 0
        for i in range(n):
            qlist[a:=bisect(qlist,plist[i],lo=1,hi=c+1,key=lambda x:plist[x])]=i
            c = max(c,a)
        return c # Chai Wah Wu, Sep 03 2023
    

Formula

Tao proves that a(n) ~ n/log n. a(n) >= pi(n) + 64 for all n >= 31957; Pollack, Pomerance, & Treviño conjecture that this is an equality. - Charles R Greathouse IV, Dec 08 2023

A365737 Length of the longest subsequence of 1,...,n on which the Euler totient function phi A000010 is nonincreasing.

Original entry on oeis.org

1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11
Offset: 1

Views

Author

Chai Wah Wu, Sep 17 2023

Keywords

Crossrefs

Programs

  • Python
    from bisect import bisect
    from sympy import totient
    def A365737(n):
        plist, qlist, c = tuple(-totient(i) for i in range(1,n+1)), [0]*(n+1), 0
        for i in range(n):
            qlist[a:=bisect(qlist,plist[i],lo=1,hi=c+1,key=lambda x:plist[x])]=i
            c = max(c,a)
        return c

A365740 Length of the longest subsequence of {m: 1<=m<=n, m not prime} on which the Euler totient function phi A000010 is nondecreasing.

Original entry on oeis.org

1, 1, 1, 2, 2, 3, 3, 4, 5, 5, 5, 6, 6, 7, 8, 9, 9, 9, 9, 10, 11, 11, 11, 11, 12, 12, 13, 13, 13, 13, 13, 14, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 21, 21, 21, 21, 21, 22, 23, 23, 24, 24, 24, 24, 25, 25
Offset: 1

Views

Author

Chai Wah Wu, Sep 17 2023

Keywords

Crossrefs

Programs

  • Python
    from bisect import bisect
    from sympy import totient, isprime
    def A365740(n):
        plist = tuple(totient(i) for i in range(1,n+1) if not isprime(i))
        m = len(plist)
        qlist, c = [0]*(m+1), 0
        for i in range(m):
            qlist[a:=bisect(qlist,plist[i],lo=1,hi=c+1,key=lambda x:plist[x])]=i
            c = max(c,a)
        return c

Formula

Pollack et al. conjectured that a(n) < A365339(n)-2 for all n >= 31957.

A365741 a(n) = A365740(10^n).

Original entry on oeis.org

1, 5, 31, 189, 1261, 9595, 77681, 654249, 5650472
Offset: 0

Views

Author

Chai Wah Wu, Sep 17 2023

Keywords

Comments

Pollack et al. listed a(4)-a(6).

Crossrefs

Programs

  • Python
    from bisect import bisect
    from sympy import totient
    def A365741(n):
        k = 10**n
        plist = tuple(totient(i) for i in range(1,k+1) if not isprime(i))
        m = len(plist)
        qlist, c = [0]*(m+1), 0
        for i in range(m):
            qlist[a:=bisect(qlist,plist[i],lo=1,hi=c+1,key=lambda x:plist[x])]=i
            c = max(c,a)
        return c

A365738 a(n) = A365737(10^n).

Original entry on oeis.org

1, 3, 12, 32, 92, 292, 995, 3029, 9651, 31817
Offset: 0

Views

Author

Chai Wah Wu, Sep 17 2023

Keywords

Crossrefs

Programs

  • Python
    from bisect import bisect
    from sympy import totient
    def A365738(n):
        k = 10**n
        plist, qlist, c = tuple(-totient(i) for i in range(1,k+1)), [0]*(k+1), 0
        for i in range(k):
            qlist[a:=bisect(qlist,plist[i],lo=1,hi=c+1,key=lambda x:plist[x])]=i
            c = max(c,a)
        return c

Extensions

a(9) from Chai Wah Wu, Oct 13 2023

A365742 Length of the largest subset of 1,...,n on which the Euler totient function phi A000010 is constant.

Original entry on oeis.org

1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10
Offset: 1

Views

Author

Chai Wah Wu, Sep 17 2023

Keywords

Crossrefs

Programs

  • Python
    from collections import Counter
    from sympy import totient
    def A365742(n): return max(Counter(totient(i) for i in range(1,n+1)).values())

Formula

Pollack et al. showed that A365737(n)-a(n) > n^0.18 for large n.

A365748 a(n) = A365742(10^n).

Original entry on oeis.org

1, 3, 10, 30, 72, 247, 937, 2844, 9261, 30742
Offset: 0

Views

Author

Chai Wah Wu, Sep 17 2023

Keywords

Crossrefs

Programs

  • Python
    from collections import Counter
    from sympy import totient
    def A365748(n): return max(Counter(totient(i) for i in range(1,10**n+1)).values())

Formula

Baker and Harman showed that a(n) >= 10^(0.7038n) for all large enough n. - Chai Wah Wu, Oct 17 2023

A371156 Length of the longest subsequence of 1, ..., n on which the Dedekind psi function (A001615) is nondecreasing.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 10, 11, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 17, 17, 18, 18, 19, 19, 19, 20, 21, 21, 22, 22, 22, 22, 23, 23, 24, 24, 24, 25, 26, 26, 27, 27, 27, 27, 28, 28, 29, 29, 29, 29, 30, 30, 31, 31, 31, 32, 33, 33, 34, 34, 34
Offset: 1

Views

Author

Chai Wah Wu, Apr 10 2024

Keywords

Comments

The envelope max_{i<=n} (a(i)-A000720(i)) appears to be slowly increasing as n increases. For instance, a(1)-A000720(1)=1, whereas a(374598)-A000720(374598)=91 and a(642852)-A000720(642852)=96.

Examples

			a(7) = 6 because A001615 is nondecreasing on 1,2,3,4,5,6 or 1,2,3,4,5,7 but not on 1,2,3,4,5,6,7.
		

Crossrefs

Programs

  • Mathematica
    Length[LongestOrderedSequence[#]] & /@ Rest[FoldList[Append, {}, Table[n DivisorSum[n, MoebiusMu[#]^2/# &], {n, 20}]]] (* Eric W. Weisstein, Mar 09 2025 *)
  • Python
    from math import prod
    from bisect import bisect
    from sympy import primefactors
    def A371156(n):
        def f(n):
            r = primefactors(n)
            return n*prod(p+1 for p in r)//prod(r)
        plist, qlist, c = tuple(f(i) for i in range(1,n+1)), [0]*(n+1), 0
        for i in range(n):
            qlist[a:=bisect(qlist,plist[i],lo=1,hi=c+1,key=lambda x:plist[x])]=i
            c = max(c,a)
        return c

Formula

0 <= a(n+1) - a(n) <= 1.
a(n) >= A000720(n)+1 since A001615(p) = p+1 for p prime.
Showing 1-10 of 11 results. Next