cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A171712 Triangle T(n,k) read by rows. Coloring of sectors in a circle.

This page as a plain text file.
%I A171712 #13 Sep 08 2022 08:45:50
%S A171712 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,
%T A171712 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,
%U A171712 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
%N A171712 Triangle T(n,k) read by rows. Coloring of sectors in a circle.
%C A171712 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.
%H A171712 G. C. Greubel, <a href="/A171712/b171712.txt">Rows n = 1..100 of triangle, flattened</a>
%F A171712 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
%e A171712 Table begins:
%e A171712   1;
%e A171712   1, 2;
%e A171712   1, 2, 3;
%e A171712   1, 2, 1, 2;
%e A171712   1, 2, 1, 2, 3;
%e A171712   1, 2, 1, 2, 1, 2;
%e A171712   1, 2, 1, 2, 1, 2, 3;
%e A171712   1, 2, 1, 2, 1, 2, 1, 2;
%p A171712 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
%t A171712 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 *)
%o A171712 (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
%o A171712 (Magma)
%o A171712 function T(n,k)
%o A171712   if k eq 1 then return 1;
%o A171712   elif k eq n then return (5-(-1)^n)/2;
%o A171712   else return (3+(-1)^k)/2;  end if; return T; end function;
%o A171712 [T(n,k): k in [1..n], n in [1..15]]; // _G. C. Greubel_, Nov 29 2019
%o A171712 (Sage)
%o A171712 def T(n, k):
%o A171712     if (k==1): return 1
%o A171712     elif (k==n): return (5-(-1)^n)/2
%o A171712     else: return (3+(-1)^k)/2
%o A171712 [[T(n, k) for k in (1..n)] for n in (1..15)] # _G. C. Greubel_, Nov 29 2019
%o A171712 (GAP)
%o A171712 T:= function(n,k)
%o A171712     if k=1 then return 1;
%o A171712     elif k=n then return (5-(-1)^n)/2;
%o A171712     else return (3+(-1)^k)/2; fi; end;
%o A171712 Flat(List([1..15], n-> List([1..n], k-> T(n,k) ))); # _G. C. Greubel_, Nov 29 2019
%Y A171712 Cf. A158478.
%K A171712 nonn,tabl
%O A171712 1,3
%A A171712 _Mats Granvik_, Dec 16 2009