%I #28 Jun 30 2018 19:54:54
%S 112,113,121,122,123,131,132,133,211,212,213,220,221,222,223,230,231,
%T 232,233,311,312,313,320,321,322,323,330,331,332,333,1012,1013,1021,
%U 1022,1023,1031,1032,1033,1102,1103,1112,1113,1120,1121,1122,1123,1130,1131
%N Matrices of the 2 X 2 sandpile group, with matrix [a,b;c,d] encoded as concat(a,b,c,d), leading 0 omitted.
%C The 2 X 2 sandpile group S2 has 192 elements (called sandpiles), which are obtained as sandpile-addition of any arbitrary 2 X 2 matrix to the neutral element E2 = [2,2;2,2]. Equivalently, these are exactly the matrices which are invariant under sandpile-addition of E2.
%C Sandpile-addition is standard matrix addition followed by the topple-process in which each element larger than 3 is decreased by 4 and each of its von Neumann neighbors is increased by 1, iterated until no element is > 3. The addition table for the group S2 is given in A300009.
%C The 2 X 2 matrices A = [a,b;c,d] are represented here as concat(a,b,c,d) (or Sum_{i,j=1..2} 10^(6-2i-j)*A[i,j]), and listed in lexicographic order. The first 30 elements (corresponding to the 3-digit terms < 1000) have a = 0 which is not displayed.
%C The opposite of the i-th element A300006(i) (in the above lexicographic order) is the A300007(i)-th element, A300008(i) = A300006(A300007(i)).
%H M. F. Hasler, <a href="/A300006/b300006.txt">Table of n, a(n) for n = 1..192</a>
%H L. David Garcia-Puente, in <a href="https://youtu.be/1MtEUErz7Gg">Sandpiles</a>, Numberphile video, on YouTube.com, Jan 13 2017
%e a(1) = 0112 represents the matrix A = [0,1;1,2]. As illustration, add this to E2 = [2,2;2,2]: A + E2 = [2,3;3,4], and the 4 "topples": it gets 4 subtracted and both neighbors (the two 3's) get incremented by 1, thus: [2,4;4;0]. Now the two 4's topple, each one incrementing the 2 and the 0 by one: [4,0;0,2]. Once again the 4 topples: [0,1;1,2]. This is the result: A (+) E2 = A.
%e a(116) = 2222 represents E2 = [2,2;2,2], which is the only nonzero 2 X 2 matrix such that M (+) M = M. (Indeed, 2222 + 2222 = 4444 -> 2222, as each 4 topples to 0 and gets +1 from each of its 2 neighbors.) It is (by definition) the neutral element in S2 := { A in M_2(Z) | A (+) E2 = A }, and it turns out that there is an opposite or inverse A' for each A in S(2), such that A (+) A' = E2. (This would not be the case for the zero matrix.)
%o (PARI) spa(A,B=0,C=0*A[,1],R=0*A[1,])={A+=B; while(B=A\4,A+=concat(B[,^1], C)+concat(C,B[,^-1])+concat(B[^1,],R)+concat(R,B[^-1,])-4*B); A} \\ sandpile addition; without 2nd arg only "topple"
%o S2=List(); forvec(v=vector(4,i,[2,5]), listput(S2,spa(Mat([v[1..2],v[3..4]]~)))); S2=Set(S2) \\ The 2 X 2 sandpile group as subset of 2 X 2 matrices with coefficients in [0..3], here determined by adding an arbitrary matrix 2 X 2 to the matrix E2 = [2,2;2,2]; equivalently one could select the 2 X 2 matrices invariant under sandpile-addition of E2: see also A007341.
%o A300006=apply( m2d=M->fromdigits(concat(Col(M~)~)), S2) \\ matrix-to-decimal encoding. Use transpose because PARI sorts matrices [a,b;c,d] as (a,c,b,d).
%Y Cf. A007341 (order of the sandpile group for (n-1) X (n-1) grid), A300008 (inverse of a(n)), A300007 (indices of the inverses), A300009 (addition table of this group).
%K nonn,fini,full
%O 1,1
%A _M. F. Hasler_, Mar 07 2018