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.

Showing 1-3 of 3 results.

A281527 Triangle read by rows: T(n,k) = minimal number of terms needed to write k/n as a signed sum of distinct unit fractions, 1 <= k < n.

Original entry on oeis.org

1, 1, 2, 1, 1, 2, 1, 2, 2, 2, 1, 1, 1, 2, 2, 1, 2, 2, 2, 3, 2, 1, 1, 2, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 3, 2, 1, 1, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 3, 3, 3, 2, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 3, 2, 2, 3, 3, 3, 3, 2, 1, 1, 2, 2, 2, 2, 1, 2, 2, 3, 3, 2, 2, 1, 2, 1, 2, 1, 2, 2, 2, 2, 2, 3, 2, 3, 2
Offset: 2

Views

Author

Arkadiusz Wesolowski, Jan 23 2017

Keywords

Examples

			The triangle T(n,k) begins:
2:                     1
3:                   1   2
4:                 1   1   2
5:               1   2   2   2
6:             1   1   1   2   2
7:           1   2   2   2   3   2
8:         1   1   2   1   2   2   2
9:       1   2   1   2   2   2   3   2
		

Crossrefs

Cf. A281530.

A281531 a(n) is the least numerator k such that the proper fraction k/n needs three or more terms as an Egyptian fraction, or 0 if no such numerator exists.

Original entry on oeis.org

0, 0, 0, 4, 0, 3, 7, 7, 8, 5, 11, 3, 6, 7, 7, 4, 13, 3, 13, 9, 5, 5, 17, 4, 6, 8, 12, 4, 14, 3, 7, 5, 8, 11, 17, 3, 6, 9, 17, 4, 18, 3, 7, 11, 7, 5, 21, 3, 8, 7, 11, 4, 13, 9, 13, 7, 7, 7, 28, 3, 5, 13, 7, 4, 10, 3, 11, 11, 13, 5, 23, 3, 6, 11, 9, 5, 11, 3, 19
Offset: 2

Views

Author

Arkadiusz Wesolowski, Jan 23 2017

Keywords

Comments

If n > 3 is prime, a(n) = A007978(n+1). - Robert Israel, Dec 26 2019

Crossrefs

Programs

  • Magma
    lst:=[]; for n in [2..80] do for k in [1..n-1] do f:=k/n; x:=1; v:=0; if Numerator(f) eq 1 then v:=1; else while f lt 2/x do if Numerator(f-1/x) eq 1 then v:=1; break; end if; x+:=1; end while; end if; if v eq 0 then Append(~lst, k); break; end if; if k eq n-1 then Append(~lst, 0); end if; end for; end for; lst;
  • Maple
    f:= proc(n) option remember; local k,T;
      T:= numtheory:-divisors(n^2);
      for k from 2 to n-1 do
        g:= igcd(k,n);
        if g > 1 then
           r:= procname(n/g);
           if k = r*g then return k fi;
        else
           if not member(-n mod k,  T mod k) then return k fi
        fi
      od;
    0
    end proc;
    map(f, [$2..100]); # Robert Israel, Dec 25 2019
  • Mathematica
    a[n_] := a[n] = Module[{k, T}, T = Divisors[n^2]; For[k = 2, k <= n - 1, k++, g = GCD[k, n]; If[g > 1, r = a[n/g]; If[k == r g, Return [k]], If[FreeQ[Mod[T, k], Mod[-n, k]], Return [k]]]]; 0];
    a /@ Range[2, 100] (* Jean-François Alcover, Oct 06 2020, after Robert Israel *)

A363937 Minimal number of terms of an Egyptian fraction to be added to, or subtracted from, harmonic number H(n) to get an integer.

Original entry on oeis.org

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
Offset: 1

Views

Author

Denis Ivanov, Jun 29 2023

Keywords

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).

Examples

			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.
		

Crossrefs

Programs

  • 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);

Extensions

a(31)-a(45) from Dmitry Petukhov, Jul 24 2023
Showing 1-3 of 3 results.