OFFSET
1,5
COMMENTS
For H(n) - floor(H(n)) and ceiling(H(n)) - H(n), the shortest mixed-sign Egyptian fractions are calculated, and the smaller length of fractions is selected.
Similar to A106394 and A224820. But those sequences use the greedy algorithm, which does not guarantee the shortest length of expansion.
For 1 < n < 41, a(n) < A363937(n) only for n = 10 and n = 22.
LINKS
Ron Knott, Egyptian Fractions
FORMULA
a(n) <= A363937(n).
EXAMPLE
For n=10: H(10) = 7381/2520 = 2.928...; H(10) - floor(H(10)) = 7381/2520 - 2 = 2341/2520 = 1/2 + 1/7 + 1/8 + 1/9 + 1/20, which cannot be expressed as the sum of fewer than 5 reciprocals, and ceiling(H(10)) - H(10) = 3 - 7381/2520 = 179/2520 = 1/30 + 1/42 + 1/72, which cannot be expressed as the sum of fewer than 3 reciprocals, so A363937(10) = 3.
But 179/2520 = 1/14 - 1/2520 (a "mixed-sign Egyptian fraction"), so a(10) = 2.
MATHEMATICA
check[f_, k_] := (If[Numerator@f == 1, Return@True];
If[k == 1, Return@False];
Catch[Do[If[check[f - 1/i, k - 1], Throw@True],
{i, Range[Ceiling[1/f], Floor[k/f]]}];
Throw@False]);
checkMixed[f_, k_, m_] := If[m == 1,
Catch[Do[If[check[1/i - f, k], Throw@True],
{i, Range[2, Floor[1/f]]}];
Throw@False],
checkMixed[f, k, m - 1]];
a[n_] := (h = HarmonicNumber[n];
d = Min[h - Floor@h, Ceiling@h - h];
j = 1;
While[Not@check[d, j], j++];
res = j;
Do[
If[checkMixed[d, i - m, m], res = i],
{i, 2, j - 1}, {m, 1, i - 1}];
res);
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Denis Ivanov, Jul 13 2023
STATUS
approved