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.

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

This page as a plain text file.
%I A286103 #24 May 08 2021 23:06:11
%S A286103 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,
%T A286103 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,
%U A286103 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
%N A286103 a(1) = 0; for n > 1, a(n) = 1 + min(a(A285734(n)), a(A285735(n))).
%C A286103 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.
%H A286103 Antti Karttunen, <a href="/A286103/b286103.txt">Table of n, a(n) for n = 1..10000</a>
%F A286103 a(1) = 0; for n > 1, a(n) = 1 + min(a(A285734(n)), a(A285735(n))).
%F A286103 a(1) = 0; for n > 1, a(n) = 1 + a(A286104(n)).
%F A286103 Other identities. For all n >= 1:
%F A286103 a(2*A005117(n)) = 1+a(A005117(n)).
%e A286103 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.
%e A286103 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.
%e A286103 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.
%e A286103 The tree with root 17 looks like this:
%e A286103                                     17
%e A286103                                      |
%e A286103                 ..................../ \..................
%e A286103                 7                                       10
%e A286103       2......../ \........5                   5......../ \........5
%e A286103      / \                 / \                 / \                 / \
%e A286103     /   \               /   \               /   \               /   \
%e A286103    /     \             /     \             /     \             /     \
%e A286103   1       1           2       3           2       3           2       3
%e A286103                     1   1   1   2       1   1   1   2       1   1   1   2
%e A286103                                1 1                 1 1                 1 1
%e A286103 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.
%o A286103 (Scheme, with memoization-macro definec)
%o A286103 (definec (A286103 n) (if (= 1 n) 0 (+ 1 (min (A286103 (A285734 n)) (A286103 (A285735 n))))))
%o A286103 (definec (A286103 n) (if (= 1 n) 0 (+ 1 (A286103 (A286104 n)))))
%o A286103 (Python)
%o A286103 from sympy.ntheory.factor_ import core
%o A286103 def issquarefree(n): return core(n) == n
%o A286103 def a285734(n):
%o A286103     if n==1: return 0
%o A286103     j=n//2
%o A286103     while True:
%o A286103         if issquarefree(j) and issquarefree(n - j): return j
%o A286103         else: j-=1
%o A286103 def a285735(n): return n - a285734(n)
%o A286103 def a286103(n): return 0 if n==1 else 1 + min(a286103(a285734(n)), a286103(a285735(n)))
%o A286103 print([a286103(n) for n in range(1, 121)]) # _Indranil Ghosh_, May 02 2017
%Y A286103 Cf. A005117, A285734, A285735, A286104, A286105, A286106.
%K A286103 nonn
%O A286103 1,4
%A A286103 _Antti Karttunen_, May 02 2017