A309038 Irregular triangle T read by rows: given a square made of n^2 squares of unit area, T(n, k) is the longest perimeter that can be obtained by removing k of n^2 squares such that the modified figure remains connected and without holes (n >= 0 and 0 <= k <= n^2).
0, 4, 0, 8, 8, 8, 4, 0, 12, 14, 16, 18, 20, 16, 12, 8, 4, 0, 16, 18, 20, 22, 24, 26, 28, 28, 28, 26, 24, 20, 16, 12, 8, 4, 0, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 42, 40, 38, 36, 32, 28, 24, 20, 16, 12, 8, 4, 0, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 56, 56, 56, 56, 56, 56, 52, 48, 44, 40, 36, 32, 28, 24, 20, 16, 12, 8, 4, 0
Offset: 0
Examples
The triangle T(n, k) begins: ---+------------------------------------------------------------------- n\k| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ---+------------------------------------------------------------------- 0 | 0 1 | 4 0 2 | 8 8 8 4 0 3 | 12 14 16 18 20 16 12 8 4 0 4 | 16 18 20 22 24 26 28 28 28 26 24 20 16 12 8 4 0 ... Here are the values of h_i's for the first seven rows of the triangle T: n h_1(n) h_2(n) h_3(n) h_4(n) -------------------------------------- 0 0 0 0 0 1 0 0 0 1 2 0 2 0 2 3 4 0 0 5 4 6 2 2 6 5 12 0 4 9 6 16 6 0 14 ... Illustrations for n = 4, k=0..15 by _Andrew Howroyd_, Sep 01 2019: (Start) __.__.__.__ __.__.__.__ __.__.__.__ __.__.__.__ | | | | | | | | | | |__ | |__ | |__ __| | | __| | __|__ | __|__ |__ |__.__.__.__| |__.__.__.__| |__| |__.__| |__| |__.__| (16) (18) (20) (22) __.__.__.__ __. .__.__ __ __.__ __ __.__ | | | |__| | | | | | | | | __| |__ __.__| |__ __.__| |__|__|__.__| |__|__|__| __|__|__.__ __|__|__.__ __|__|__.__ __|__|__.__ |__| |__.__| |__| |__.__| |__| |__.__| |__| |__.__| (24) (26) (28) (28) __ __ __ __ | | __|__| __ __|__| __ __|__| __ __ |__|__|__| |__|__|__| |__|__|__| |__|__|__| __|__|__.__ __|__|__.__ __|__|__ __|__|__ |__| |__.__| |__| |__.__| |__| |__| |__| |__| (28) (26) (24) (20) __ __ __ |__|__|__| __|__| __ __ __|__| __|__| __|__| |__| |__| |__| |__| (16) (12) (8) (4) (End)
Programs
-
Mathematica
h4[n_]:=If[n>2,(1/8)(-29+12n+2n^2-3*Cos[n*Pi]-12*Sin[n*Pi/2]),n]; h3[n_]:=1-Cos[n*Pi]-4*KroneckerDelta[n,1]+2*KroneckerDelta[n,4]+2*Sin[n*Pi/2]; h2[n_]:=If[n>4,(1/8)(71-20n+2n^2+25Cos[n*Pi]+4Sin[n*Pi/2]),2*(KroneckerDelta[n,2]+KroneckerDelta[n,4])]; h1[n_]:=n^2-(h2[n]+h3[n]+h4[n]); T[n_,k_]:=If[0<=k<=h1[n],2(2n+k),If[h1[n]
Formula
T(n, 0) = A008586(n).
T(n, k) = 2*(2*n + k) for 0 <= k <= h_1(n), T(n, k) = 2*(2*n + h_1(n)) for h_1(n) <= k <= h_1(n) + h_2(n), T(n, k) = 2*(2*(n + h_1(n)) + h_2(n) - k) for h_1(n) + h_2(n) <= k <= h_1(n) + h_2(n) + h_3(n), T(n, k) = 2*(2*(n + h_2(n) - k) + 3*h_1(n) + h_3(n)), for h_1(n) + h_2(n) + h_3(n) <= k <= n^2, where h_4(n) = n for 0 <= n <= 2 and h_4(n) = (1/8)*(-29 + 12*n + 2*n^2 - 3*cos(n*Pi) - 12*sin(n*Pi/2)) for n > 2, h_3(n) = 2*delta(n, 4) - 4*delta(n, 1) + 1 - cos(n*Pi) + 2*sin(n*Pi/2) and delta(i, j) is the Kronecker delta, h_2(n) = 2*(delta(n, 2) + delta(n, 4)) for 0 <= n <= 4 and h_2(n) = (1/8)*(71 - 20*n + 2*n^2 + 25*cos(n*Pi) + 4*sin(n*Pi/2)) for n > 4, h_1(n) = n^2 - (h_1(n) + h_2(n) + h_3(n)).
Comments