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-3 of 3 results.

A286107 a(1) = 0, for n > 1, if A286106(n) > 0, then a(n) = A285735(n), otherwise a(n) = A285734(n).

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 5, 5, 6, 5, 5, 6, 7, 7, 10, 10, 7, 7, 13, 10, 10, 11, 13, 13, 14, 13, 13, 14, 14, 15, 14, 15, 19, 17, 14, 19, 15, 19, 17, 19, 19, 21, 21, 22, 23, 23, 26, 26, 23, 29, 29, 26, 23, 23, 26, 26, 26, 29, 29, 30, 30, 31, 33, 33, 31, 33, 33, 34, 34, 35, 34, 35, 38, 37, 38, 38, 38, 39, 38, 41, 39, 41, 41, 42, 42, 43, 41, 46, 46, 47, 38, 46, 46, 47
Offset: 1

Views

Author

Antti Karttunen, May 02 2017

Keywords

Comments

After the initial zero, all terms are squarefree numbers (A005117).

Crossrefs

Programs

  • Python
    from sympy.ntheory.factor_ import core
    def issquarefree(n): return core(n) == n
    def a285734(n):
        if n==1: return 0
        j=n//2
        while True:
            if issquarefree(j) and issquarefree(n - j): return j
            else: j-=1
    def a285735(n): return n - a285734(n)
    def a286105(n): return 0 if n==1 else 1 + max(a286105(a285734(n)), a286105(a285735(n)))
    def a286106(n): return 0 if n==1 else a286105(a285735(n)) - a286105(a285734(n))
    def a286107(n): return 0 if n==1 else a285735(n) if a286106(n)>0 else a285734(n)
    print([a286107(n) for n in range(1, 121)]) # Indranil Ghosh, May 02 2017
  • Scheme
    (define (A286107 n) (cond ((= 1 n) 0) ((> (A286106 n) 0) (A285735 n)) (else (A285734 n))))
    

Formula

If A286105(A285735(n)) > A286105(A285734(n)), a(n) = A285735(n), otherwise a(n) = A285734(n), a(1) = 0.

A286105 a(1) = 0; for n > 1, a(n) = 1 + max(a(A285734(n)), a(A285735(n))).

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 6, 6, 7, 6, 7, 6, 7, 7, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 7, 8, 8, 7, 7, 7, 7, 7, 8, 7, 8, 8, 8, 7, 8, 8, 7, 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8
Offset: 1

Views

Author

Antti Karttunen, May 02 2017

Keywords

Comments

By invoking A285734 and A285735 recursively, any natural number n > 1 can be decomposed as a sum of successively smaller squarefree numbers, until only n instances of 1's remain. This process can be depicted as a binary tree, where 1's are leaves, and any other node n branches to the left as A285734(n) and to the right as A285735(n). This sequence gives the distance from the root of tree (n) to a leaf (1) that is furthest removed from the root.

Examples

			A285734(2) = A285735(2) = 1, thus a tree with root 2 has just two leaves 1 and 1, so the maximum distance to them is 1, thus a(2) = 1.
A285734(3) = 1 and A285735(3) = 2, thus a tree with root 3 has one immediate leave 1 and the subtree 2 as its other branch, so the distance to a farthest leaf (1) is two edges, thus a(3) = 2.
A285734(5) = 2 and A285735(3) = 3, thus a tree with root 5 has the subtree 2 as its other branch, and the subtree 3 as the other branch, so the maximum distance to a leaf (1) is 1 + longest distance computed for cases 2 and 3, thus a(5) = 1 + max(1,2) = 3.
The tree with root 17 looks like this:
                                    17
                                     |
                ..................../ \..................
                7                                       10
      2......../ \........5                   5......../ \........5
     / \                 / \                 / \                 / \
    /   \               /   \               /   \               /   \
   /     \             /     \             /     \             /     \
  1       1           2       3           2       3           2       3
                    1   1   1   2       1   1   1   2       1   1   1   2
                               1 1                 1 1                 1 1
We see that the longest distance to 1 from the root can be found for example at the right border of the tree, five edges in total, thus a(17) = 5.
		

Crossrefs

Programs

  • Python
    from sympy.ntheory.factor_ import core
    def issquarefree(n): return core(n) == n
    def a285734(n):
        if n==1: return 0
        j=n//2
        while True:
            if issquarefree(j) and issquarefree(n - j): return j
            else: j-=1
    def a285735(n): return n - a285734(n)
    def a286105(n): return 0 if n==1 else 1 + max(a286105(a285734(n)), a286105(a285735(n)))
    print([a286105(n) for n in range(1, 121)]) # Indranil Ghosh, May 02 2017

Formula

a(1) = 0 and for n > 1, a(n) = 1 + max(a(A285734(n)), a(A285735(n))).
a(1) = 1 and for n > 1, a(n) = 1 + a(A286107(n)).
Other identities. For all n >= 1:
a(2*A005117(n)) = 1+a(A005117(n)).

A286103 a(1) = 0; for n > 1, a(n) = 1 + min(a(A285734(n)), a(A285735(n))).

Original entry on oeis.org

0, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 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, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 5, 6, 6, 6, 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
Offset: 1

Views

Author

Antti Karttunen, May 02 2017

Keywords

Comments

By invoking A285734 and A285735 recursively, any natural number n > 1 can be decomposed as a sum of successively smaller squarefree numbers, until only n instances of 1's remain. This process can be depicted as a binary tree, where 1's are leaves, and any other node n branches to the left as A285734(n) and to the right as A285735(n). This sequence gives the distance from the root of tree (n) to a leaf (1) that is nearest to the root.

Examples

			A285734(2) = A285735(2) = 1, thus a tree with root 2 has just two leaves 1 and 1, so the minimum distance to them is 1, thus a(2) = 1.
A285734(3) = 1 and A285735(3) = 2, thus a tree with root 3 has one immediate leave 1 and the subtree 2 as its other branch, so the minimum distance to a leaf (1) is one edge, thus a(3) = 1.
A285734(5) = 2 and A285735(3) = 3, thus a tree with root 5 has the subtree 2 as its other branch, and the subtree 3 as the other branch, so the minimum distance to a leaf (1) is 1 + shortest distance computed for cases 2 and 3, thus a(5) = 1 + min(1,1) = 2.
The tree with root 17 looks like this:
                                    17
                                     |
                ..................../ \..................
                7                                       10
      2......../ \........5                   5......../ \........5
     / \                 / \                 / \                 / \
    /   \               /   \               /   \               /   \
   /     \             /     \             /     \             /     \
  1       1           2       3           2       3           2       3
                    1   1   1   2       1   1   1   2       1   1   1   2
                               1 1                 1 1                 1 1
We see that the shortest distance to 1 from the root is at the left border of the tree, just three edges, thus a(17) = 3.
		

Crossrefs

Programs

  • Python
    from sympy.ntheory.factor_ import core
    def issquarefree(n): return core(n) == n
    def a285734(n):
        if n==1: return 0
        j=n//2
        while True:
            if issquarefree(j) and issquarefree(n - j): return j
            else: j-=1
    def a285735(n): return n - a285734(n)
    def a286103(n): return 0 if n==1 else 1 + min(a286103(a285734(n)), a286103(a285735(n)))
    print([a286103(n) for n in range(1, 121)]) # Indranil Ghosh, May 02 2017

Formula

a(1) = 0; for n > 1, a(n) = 1 + min(a(A285734(n)), a(A285735(n))).
a(1) = 0; for n > 1, a(n) = 1 + a(A286104(n)).
Other identities. For all n >= 1:
a(2*A005117(n)) = 1+a(A005117(n)).
Showing 1-3 of 3 results.