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.
FORMULA
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
KEYWORD
nonn,easy
AUTHOR
Ben Orlin, Jul 18 2025
STATUS
approved
