login
A171712
Triangle T(n,k) read by rows. Coloring of sectors in a circle.
1
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, 1, 2, 1, 2, 1, 2, 1, 2, 3, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2
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.
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
Cf. A158478.
Sequence in context: A349203 A106394 A325530 * A091412 A106036 A007001
KEYWORD
nonn,tabl
AUTHOR
Mats Granvik, Dec 16 2009
STATUS
approved