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.

A228286 Smallest x + y*z, given x*y + z = n (for positive integers x, y, z).

Original entry on oeis.org

2, 3, 4, 4, 6, 5, 7, 6, 6, 7, 9, 7, 10, 9, 8, 8, 12, 9, 12, 9, 10, 13, 15, 10, 10, 15, 12, 11, 15, 11, 16, 12, 14, 17, 12, 12, 17, 21, 16, 13, 18, 13, 19, 15, 14, 19, 24, 14, 14, 15, 20, 17, 21, 15, 16, 15, 22, 25, 28, 16, 22, 27, 16, 16, 18, 17, 23, 21, 25, 17
Offset: 2

Views

Author

Andy Niedermaier, Aug 19 2013

Keywords

Comments

One of the terms in this sequence is the subject of a problem on the 2013 ARML contest (Team Round).
The Mathematica code below computes the quadruple {x, y, z, a(n)}, where z is as small as possible (in the event of a tie).

Examples

			For n = 160, a(n) = 50, as 26 * 6 + 4 = 160 and 26 + 6 * 4 = 50 and no triple of positive integers (x, y, z) with xy + z = 160 gives a smaller value for x + yz.
		

Crossrefs

Cf. A228287 (z-coordinate of the triple (x, y, z) that minimizes x + yz).
Cf. A228288 (least k such that z = n, given xy + z = k and x + yz is minimized).

Programs

  • Maple
    A228286 := proc(n)
        local a,x,y,z ;
        a := n+n^2 ;
        for z from 1 to n-1 do
            for x in numtheory[divisors](n-z) do
                y := (n-z)/x ;
                a := min(a, x+y*z) ;
            end do:
        end do:
        return a;
    end proc: # R. J. Mathar, Sep 02 2013
  • Mathematica
    a[n_] := Module[{X, bX, bT, m},
      bT = n + 1;
      bX = {n - 1, 1, 1, n};
      X = bX;
      m = Floor[2*Sqrt[X[[3]]*(n - X[[3]])]];
      While[bT >= m && X[[3]] <= n/2,
       X[[2]] = Max[1, Floor[(n - bX[[3]])/bT]];
       While[X[[2]] <= Floor[bT/X[[3]]],
        If[Mod[n - X[[3]], X[[2]]] == 0,
         X[[1]] = (n - X[[3]])/X[[2]];
         X[[4]] = X[[1]] + X[[2]]*X[[3]];
         If[X[[4]] < bX[[4]], bX = X]];
        X[[2]] = X[[2]] + 1];
       X[[3]] = X[[3]] + 1;
       m = Floor[2*Sqrt[X[[3]]*(n - X[[3]])]]];
      Return[bX]]; Table[a[n][[-1]], {n, 2, 100}]