login
A186518
Triangle A177517 mod 2. Mahonian numbers modulo 2.
2
1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1
OFFSET
1
COMMENTS
Each column is a palindrome. The left half of the triangle displays chaos, the right half consists of triangles filled with zeros. Pattern is similar to patterns found in elementary cellular automata. The rule is different.
Compare the recurrence for this triangle:
T(1,1)=1, n > 1: T(n,1)=0, k > 1: T(n,k) = (Sum_{i=1..k-1} of T(n-i,k-1)) mod 2
with the recurrence for Dirichlet convolutions:
T(n,1)=1, k > 1: T(n,k) = ((Sum_{i=1..k-1} T(n-i,k-1)) mod 2) - ((Sum_{i=1..k-1} T(n-i,k)) mod 2) which in turn gives triangle A051731.
FORMULA
T(1,1)=1, n > 1: T(n,1)=0, k > 1: T(n,k) = (Sum_{i=1..k-1} T(n-i,k-1)) mod 2.
EXAMPLE
Triangle starts:
1;
0, 1;
0, 0, 1;
0, 0, 1, 1;
0, 0, 0, 0, 1;
0, 0, 0, 0, 1, 1;
0, 0, 0, 1, 1, 0, 1;
0, 0, 0, 0, 0, 1, 1, 1;
0, 0, 0, 0, 1, 1, 0, 0, 1;
0, 0, 0, 0, 1, 0, 1, 0, 1, 1;
0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1;
MAPLE
T:= proc(n, k) option remember;
if k=n then 1
else `mod`( add(T(n-j, k-1), j=1..k-1), 2)
fi; end:
seq(seq(T(n, k), k=1..n), n=1..12); # G. C. Greubel, Dec 17 2019
MATHEMATICA
nn = 19; t[n_, 1] = If[n==1, 1, 0]; t[n_, k_]:= t[n, k] = If[n>= k, Mod[Sum[t[n-i, k-1], {i, 1, k-1}], 2], 0]; Flatten[Table[t[n, k], {n, nn}, {k, n}]] (* Mats Granvik, Dec 06 2019 *)
PROG
(Excel cell formula, European) =if(column()=1; if(row()=1; 1; 0); if(row()>=column(); mod(sum(indirect(address(row()-column()+1; column()-1; 4)&":"&address(row()-1; column()-1; 4); 4)); 2); 0))
(Excel cell formula, American) =if(column()=1, if(row()=1, 1, 0), if(row()>=column(), mod(sum(indirect(address(row()-column()+1, column()-1, 4)&":"&address(row()-1, column()-1, 4), 4)), 2), 0))
(PARI) T(n, k) = if(k<1 || k>n, 0, if(k==n, 1, sum(j=1, k-1, T(n-j, k-1))%2 ));
for(n=1, 12, for(k=1, n, print1(T(n, k), ", "))) \\ G. C. Greubel, Dec 17 2019
(Magma)
function T(n, k)
if k lt 0 or k gt n then return 0;
elif k eq n then return 1;
elif k eq 1 then return 0;
else return (&+[T(n-j, k-1): j in [1..k-1]]) mod 2;
end if; return T; end function;
[T(n, k): k in [1..n], n in [1..12]]; // G. C. Greubel, Dec 17 2019
(Sage)
@CachedFunction
def T(n, k):
if (k<0 or k>n): return 0
elif (k==n): return 1
elif (k==1): return 0
else: return mod( sum(T(n-j, k-1) for j in (1..k-1)), 2)
[[T(n, k) for k in (1..n)] for n in (1..12)] # G. C. Greubel, Dec 17 2019
(GAP)
T:= function(n, k)
if k<0 or k>n then return 0;
elif k=n then return 1;
elif k=1 then return 0;
else return Sum([1..k-1], j-> T(n-j, k-1)) mod 2;
fi;
end;
Flat(List([1..12], n-> List([1..n], k-> T(n, k) ))); # G. C. Greubel, Dec 17 2019
CROSSREFS
Cf. A177517, A008302, A186519 (row sums).
Sequence in context: A114482 A371844 A365799 * A127829 A127831 A164364
KEYWORD
nonn,tabl
AUTHOR
Mats Granvik, Feb 23 2011
STATUS
approved