login
A386318
a(n) = the minimum value of (x + 2)*(y + 2) such that x*y = n.
2
4, 9, 12, 15, 16, 21, 20, 27, 24, 25, 28, 39, 30, 45, 36, 35, 36, 57, 40, 63, 42, 45, 52, 75, 48, 49, 60, 55, 54, 93, 56, 99, 60, 65, 76, 63, 64, 117, 84, 75, 70, 129, 72, 135, 78, 77, 100, 147, 80, 81, 84, 95, 90, 165, 88, 91, 90, 105, 124, 183, 96, 189, 132, 99, 100, 105, 104, 207
OFFSET
0,1
COMMENTS
Smallest number of elements in a rectangular array with precisely n interior elements.
If baking square brownies in a rectangular pan, a(n) is the minimum number of brownies required to have precisely n gooey center brownies.
A063655(n) gives the smallest semiperimeter b+d of an integral rectangle with area n = b*d. Here, a(n) = (b+2)(d+2) = n + 2*(A063655(n)) + 4.
a(n) >= A386316(n) since A386316 relaxes the conditions to x*y >= n rather than equality.
FORMULA
a(p) = 3*(p+2) for p prime.
a(n) = (x + 2)*(y + 2) for n = x*y semiprime (a term of A001358).
a(k^2) = (k+2)^2 = A386316(k^2).
a(n) = n + 2*(A063655(n)) + 4.
EXAMPLE
a(5) = 21 because the 3 X 7 array is the unique array with precisely 5 interior elements.
a(12) = 30 because the 5 X 6 array is the smallest with precisely 12 interior elements (the others being 3 X 14 and 4 X 8).
MATHEMATICA
a[n_] := Min[((# + 2)*(n/# + 2))& /@ Select[Divisors[n], #^2 <= n &]]; Array[a, 100] (* Amiram Eldar, Jul 19 2025 *)
PROG
(PARI) a(n) = vecmin(apply(x->((x + 2)*(n/x + 2)), divisors(n))); \\ Michel Marcus, Jul 19 2025
(Python)
from sympy import divisors
def A386318(n):
if n == 0: return 4
l = len(d:=divisors(n))
return (d[(l-1)>>1]+2)*(d[l>>1]+2) # Chai Wah Wu, Jul 27 2025
CROSSREFS
Sequence in context: A386316 A368998 A388970 * A287367 A312850 A312851
KEYWORD
nonn,easy
AUTHOR
Ben Orlin, Jul 18 2025
STATUS
approved