OFFSET
0,3
COMMENTS
The perimeter is the sum of all parts having less than two neighbors.
a(n) is also the smallest perimeter among all sets of positive integers whose volume (sum) is n. - Patrick Devlin, Jul 23 2013
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..5000
EXAMPLE
a(0) = 0: the empty partition [] has perimeter 0.
a(1) = 1: [1] has perimeter 1.
a(3) = 3: [1,2], [3] have perimeter 3.
a(6) = 4: [1,2,3] has perimeter 4.
a(7) = 7: [1,2,4], [3,4], [2,5], [1,6], [7] have perimeter 7; no partition of 7 into distinct parts has a smaller perimeter.
a(10) = 5: [1,2,3,4] has perimeter 5.
a(15) = 6: [1,2,3,4,5] has perimeter 6.
a(29) = 15: [1,2,3,4,5,6,8] has perimeter 1+6+8 = 15.
a(30) = 12: [4,5,6,7,8] has perimeter 12.
MAPLE
b:= proc(n, i, t) option remember; `if`(n=0, `if`(t>1, i+1, 0),
`if`(i<1, infinity, min(`if`(t>1, i+1, 0)+b(n, i-1, iquo(t, 2)),
`if`(i>n, NULL, `if`(t=2, i+1, 0)+b(n-i, i-1, iquo(t, 2)+2)))))
end:
a:= n-> b(n$2, 0):
seq(a(n), n=0..100);
MATHEMATICA
b[n_, i_, t_] := b[n, i, t] = If[n==0, If[t>1, i+1, 0], If[i<1, Infinity, Min[If[t>1, i+1, 0] + b[n, i-1, Quotient[t, 2]], If[i>n, Infinity, If[t == 2, i+1, 0] + b[n-i, i-1, Quotient[t, 2]+2]]]]]; a[n_] := b[n, n, 0]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Feb 15 2017, translated from Maple *)
CROSSREFS
AUTHOR
Alois P. Heinz, Jul 16 2013
STATUS
approved