login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A363937 Minimal number of terms of an Egyptian fraction to be added to, or subtracted from, harmonic number H(n) to get an integer. 1
0, 1, 1, 1, 2, 2, 3, 3, 3, 3, 2, 3, 4, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 4, 5, 5, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,5
COMMENTS
The shortest Egyptian fractions for H(n) - floor(H(n)) and ceiling(H(n)) - H(n) are calculated and the smaller length of those fractions is a(n).
LINKS
EXAMPLE
For n = 2: H(2) = 3/2 which is between 1 and 2 and they are reached by the same H(2) - 1 = 2 - H(2) = 1/2 which is 1 term, so a(2) = 1.
For n = 5: H(5) = 137/60 is between 2 and 3; going up 3 - H(5) = 1/2 + 1/6 + 1/20 is 3 terms but going down H(5) - 2 = 1/5 + 1/12 is 2 terms, so the latter is shorter and a(5) = 2 terms.
MATHEMATICA
(* Thanks to Ron Knott for the algorithm. Slow for n>15. *)
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]
);
a[n_]:= (h = HarmonicNumber[n];
d = {h - Floor[h], Ceiling[h] - h};
j = 1;
While[Not[Or @@ (check[#, j] & /@ d)], j++]; j);
CROSSREFS
Sequence in context: A348459 A266123 A115230 * A338686 A338687 A331677
KEYWORD
nonn,more
AUTHOR
Denis Ivanov, Jun 29 2023
EXTENSIONS
a(31)-a(45) from Dmitry Petukhov, Jul 24 2023
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 11 22:08 EDT 2024. Contains 375076 sequences. (Running on oeis4.)