OFFSET
1,3
COMMENTS
One row equals a coloring of n sectors in a circle and each number in the k-th column represents a color in the k-th sector of the circle. No pair of adjacent sectors can have the same color. The smallest numbers are chosen as colors and they are ordered from smallest to largest.
LINKS
G. C. Greubel, Rows n = 1..100 of triangle, flattened
FORMULA
T(n, k) = (3 + (-1)^k)/2 with T(n, 1) = 1 and T(n, n) = (5 - (-1)^n)/2 for n >= 2. - G. C. Greubel, Nov 29 2019
EXAMPLE
Table begins:
1;
1, 2;
1, 2, 3;
1, 2, 1, 2;
1, 2, 1, 2, 3;
1, 2, 1, 2, 1, 2;
1, 2, 1, 2, 1, 2, 3;
1, 2, 1, 2, 1, 2, 1, 2;
MAPLE
seq(seq( `if`(k=1, 1, `if`(k=n, (5-(-1)^n)/2, (3+(-1)^k)/2 )), k=1..n), n=1..15); # G. C. Greubel, Nov 29 2019
MATHEMATICA
T[n_, k_]:= If[k==1, 1, If[k==n, (5-(-1)^n)/2, (3+(-1)^k)/2]]; Table[T[n, k], {n, 15}, {k, n}]//Flatten (* G. C. Greubel, Nov 29 2019 *)
PROG
(PARI) T(n, k) = if(k==1, 1, if(k==n, (5-(-1)^n)/2, (3+(-1)^k)/2 )); \\ G. C. Greubel, Nov 29 2019
(Magma)
function T(n, k)
if k eq 1 then return 1;
elif k eq n then return (5-(-1)^n)/2;
else return (3+(-1)^k)/2; end if; return T; end function;
[T(n, k): k in [1..n], n in [1..15]]; // G. C. Greubel, Nov 29 2019
(Sage)
def T(n, k):
if (k==1): return 1
elif (k==n): return (5-(-1)^n)/2
else: return (3+(-1)^k)/2
[[T(n, k) for k in (1..n)] for n in (1..15)] # G. C. Greubel, Nov 29 2019
(GAP)
T:= function(n, k)
if k=1 then return 1;
elif k=n then return (5-(-1)^n)/2;
else return (3+(-1)^k)/2; fi; end;
Flat(List([1..15], n-> List([1..n], k-> T(n, k) ))); # G. C. Greubel, Nov 29 2019
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Mats Granvik, Dec 16 2009
STATUS
approved