OFFSET
1,3
COMMENTS
Among rooted trees with n vertices in which vertices at depth level i-1 all have b_i children each (generalized Bethe trees), a(n) is the smallest sum of those numbers of children.
There are A003238(n) trees of this type (and sequences of b_i).
LINKS
Matthieu Pluntz, Table of n, a(n) for n = 1..20000
FORMULA
a(1) = 0; a(n+1) = min_{k divides n} (k + a(n/k)).
EXAMPLE
a(5) = 3 is reached by b_1 = 2, b_2 = 1. 5 = 1 + b_1*(1 + b_2), 3 = b_1 + b_2.
MAPLE
a:= proc(n) option remember; `if`(n=1, 0, min(
seq((n-1)/d+a(d), d=numtheory[divisors](n-1))))
end:
seq(a(n), n=1..100); # Alois P. Heinz, Dec 06 2024
MATHEMATICA
a[n_] := a[n] = If[n == 1, 0, Min[Table[(n-1)/d + a[d], {d, Divisors[n-1]}]]];
Table[a[n], {n, 1, 100}](* Jean-François Alcover, Jan 26 2025, after Alois P. Heinz *)
PROG
(R)
a = rep(0, N)
for(n in 1:(N-1)){
divs = numbers::divisors(n)
a[n+1] = min(divs + a[n/divs])
}
CROSSREFS
KEYWORD
easy,nonn,changed
AUTHOR
Matthieu Pluntz, Dec 06 2024
STATUS
approved