OFFSET
1,6
COMMENTS
Refer to triangle expansions in A061777 and A101946 (and their companions for m-gons) which are "vertex to vertex" and "vertex to side" versions respectively. The label values at each iteration can be arranged as triangle. Any m-gon can also be arranged as the same triangle with conditions: (i) m is odd and expansion is "vertex to vertex" version or (ii) m is even and expansion is "vertex to side" version. m*Sum_{i=1..k}T(n,k) gives the total label value in n-th iteration. See illustration.
LINKS
G. C. Greubel, Rows n = 1..50 of the triangle, flattened
Kival Ngaokrajang, Illustration of initial terms
FORMULA
T(n, k) = ( T(n-1, k) if k <= (n+1)/2) otherwise T(n-1, k-1) + T(n-1, k) ) for odd n rows, ( T(n-1, k-1) + T(n-1, k) if k < (n+2)/2 otherwise T(n, k - n/2) ) for even n rows, with T(n, 1) = 1 and T(n, n) = floor((n+1)/2). - G. C. Greubel, Feb 18 2022
EXAMPLE
Triangle begins:
1;
1, 1;
1, 1, 2;
1, 2, 1, 2;
1, 2, 1, 3, 3;
1, 3, 3, 1, 3, 3;
1, 3, 3, 1, 4, 6, 4;
1, 4, 6, 4, 1, 4, 6, 4;
1, 4, 6, 4, 1, 5, 10, 10, 5;
1, 5, 10, 10, 5, 1, 5, 10, 10, 5;
...
MATHEMATICA
T[n_, k_]:= T[n, k]= If[k==1, 1, If[k==n, Floor[(n+1)/2], If[OddQ[n], If[k<=(n+ 1)/2, T[n-1, k], T[n-1, k-1] + T[n-1, k]], If[k<n/2 +1, T[n-1, k-1] + T[n-1, k], T[n, k-n/2] ]]]];
Table[T[n, k], {n, 15}, {k, n}]//Flatten (* G. C. Greubel, Feb 18 2022 *)
PROG
(Small Basic)
a[1][1]=1
a[2][1]=1
a[2][2]=1
TextWindow.Write(1+", "+1+", "+1+", ")
for n=3 To 30
If Math.Remainder(n, 2)=1 then
'===========odd n=================
j=1
for k=1 To n
If k <= (n/2+1/2) then
a[n][k]=a[n-1][k]
Else
a[n][k]=a[n][j]+a[n][j+1]
j=j+1
EndIf
TextWindow.Write(a[n][k]+", ")
EndFor
else
'==============even n===============
For k=1 To n
If k <=1 Then
a[n][k]=1
Else
If k < n/2+1 then
a[n][k]=a[n-1][k-1]+a[n-1][k]
Else
a[n][k]=a[n][k-n/2]
EndIf
EndIf
TextWindow.Write(a[n][k]+", ")
EndFor
EndIf
EndFor
(Sage)
@CachedFunction
def T(n, k): # A247976
if (k==1): return 1
elif (k==n): return (n+1)//2
elif (n%2==1): return T(n-1, k) if (k <= (n+1)/2) else T(n-1, k-1) + T(n-1, k)
else: return T(n-1, k-1)+T(n-1, k) if (k < (n+2)/2) else T(n, k-n/2)
flatten([[T(n, k) for k in (1..n)] for n in (1..15)]) # G. C. Greubel, Feb 18 2022
CROSSREFS
KEYWORD
tabl,nonn
AUTHOR
Kival Ngaokrajang, Sep 28 2014
STATUS
approved