login
A309228
a(n) is the greatest possible height of a binary tree where all nodes hold positive squares and all interior nodes also equal the sum of their two children and the root node has value n^2.
2
1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 3, 1, 2, 1, 3, 1, 1, 2, 1, 1, 1, 1, 3, 3, 1, 1, 3, 2, 1, 1, 1, 3, 2, 1, 3, 1, 3, 2, 3, 1, 1, 1, 2, 1, 1, 1, 1, 3, 3, 3, 3, 1, 2, 1, 1, 3, 1, 2, 3, 1, 1, 1, 4, 1, 1, 3, 1, 2, 1, 1, 3, 3, 3, 1, 1, 3, 1, 2, 1, 3, 1, 1, 4, 1, 3
OFFSET
1,5
COMMENTS
The sequence is unbounded and for any k > 0, A309167(k) is the least n such that a(n) = k.
LINKS
FORMULA
a(n) = 1 iff n belongs to A004144.
a(A309167(n)) = n.
If n^2 = u^2 + v^2 with u > v > 0, then a(n) >= 1 + max(a(u), a(v)).
EXAMPLE
a(1) = 1:
1^2
|
a(5) = 2:
3^2 4^2
\ /
\ /
5^2
|
a(13) = 3:
3^2 4^2
\ /
\ /
5^2 12^2
\ /
\ /
13^2
|
MAPLE
f:= proc(n) option remember; local S, x, y;
S:= map(t -> subs(t, [x, y]), {isolve(x^2+y^2=n^2)});
S:= select(t -> type(t, list(posint)) and t[2]>=t[1], S);
if S = {} then 1 else 1+max(map(procname, map(op, S))) fi
end proc:
map(f, [$1..100]); # Robert Israel, Feb 27 2022
MATHEMATICA
a = Table[1, {m = 100}];
Do[Do[If[IntegerQ@ Sqrt[v2 = n^2-u^2], a[[n]] = Max[a[[n]], 1+Max[a[[u]], a[[Floor@ Sqrt[v2]]]]]], {u, 1, n-1}], {n, 1, m}];
Table[a[[n]], {n, 1, m}] (* Jean-François Alcover, Aug 19 2022, after PARI code *)
PROG
(PARI) a = vector(87, n, 1); for (n=1, #a, for (u=1, n-1, if (issquare(v2=n^2-u^2), a[n]=max(a[n], 1+max(a[u], a[sqrtint(v2)])))); print1 (a[n]", "))
CROSSREFS
Sequence in context: A084115 A284154 A080028 * A309778 A143223 A063993
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Jul 16 2019
STATUS
approved