login
Triangle T(n,k) read by rows: T(n,k) = 1 if (n mod k) <= 2*k/9, -1 if 2*k/9 < (n mod k) <= 4*k/9, otherwise 0.
1

%I #17 Dec 04 2022 08:33:27

%S 1,1,1,1,0,1,1,1,-1,1,1,0,0,-1,1,1,1,1,0,1,1,1,0,-1,0,-1,1,1,1,1,0,1,

%T 0,-1,1,1,1,0,1,-1,0,0,-1,1,1,1,1,-1,0,1,0,-1,-1,1,1,1,0,0,0,1,0,0,-1,

%U 1,1,1,1,1,1,1,-1,1,0,0,-1,1,1,1,1,0,-1,-1,0,1,0,0,-1,-1,1,1,1

%N Triangle T(n,k) read by rows: T(n,k) = 1 if (n mod k) <= 2*k/9, -1 if 2*k/9 < (n mod k) <= 4*k/9, otherwise 0.

%H G. C. Greubel, <a href="/A164381/b164381.txt">Table of n, a(n) for the first 50 rows, flattened</a>

%e Triangle begins as:

%e 1;

%e 1, 1;

%e 1, 0, 1;

%e 1, 1, -1, 1;

%e 1, 0, 0, -1, 1;

%e 1, 1, 1, 0, 1, 1;

%e 1, 0, -1, 0, -1, 1, 1;

%e 1, 1, 0, 1, 0, -1, 1, 1;

%e 1, 0, 1, -1, 0, 0, -1, 1, 1;

%e 1, 1, -1, 0, 1, 0, -1, -1, 1, 1;

%t T[n_, k_]:= If[Mod[n,k]/k<=2/9, 1, If[2/9<Mod[n,k]/k<=4/9, -1, 0]];

%t Table[T[n, k], {n,12}, {k,n}]//Flatten

%o (Magma)

%o function A164381(n,k)

%o if (n mod k) le 2*k/9 then return 1;

%o elif 2*k/9 lt (n mod k) and (n mod k) le 4*k/9 then return -1;

%o else return 0;

%o end if; return A164381;

%o end function;

%o [A164381(n,k): k in [1..n], n in [1..12]]; // _G. C. Greubel_, Dec 03 2022

%o (SageMath)

%o def A164381(n,k):

%o if ((n%k)/k <= 2/9): return 1

%o elif (2/9 < (n%k)/k <= 4/9): return -1

%o else: return 0

%o flatten([[A164381(n,k) for k in range(1,n+1)] for n in range(1,17)]) # _G. C. Greubel_, Dec 03 2022

%Y Cf. A051731.

%K sign,less,tabl

%O 0,1

%A _Roger L. Bagula_ and _Mats Granvik_, Aug 14 2009

%E Edited by _G. C. Greubel_, Dec 03 2022