// output of ./demo/seq/A249872-demo.cc:
// Description:
//% OEIS sequence A249872:
//% Number of iterations to reach a final state for an n X n lattice of sand piles on a torus.
//% Also A293452: number of iterations for an n X k lattice.

arg 1: 3 == nr  [Number of rows (nr>=1)]  default=3
arg 2: 3 == nr  [Number of columns (nc>=1)]  default=3
1:
 1 0 5
 4 5 4
 4 5 4

2:
 2 1 1
 4 5 5
 4 5 5

3:
 3 1 1
 0 6 6
 5 5 5

4:
 3 2 1
 1 2 7
 5 6 5

5:
 3 2 2
 2 3 3
 5 6 6

6:
 4 2 2
 3 3 3
 1 7 7

7:
 4 3 2
 3 4 3
 2 3 8

8:
 4 3 3
 3 4 4
 3 4 4

9:
 0 4 3
 4 0 5
 3 5 4

10:
 0 4 4
 5 1 1
 3 5 5

11:
 0 5 4
 5 2 1
 4 1 6

12:
 0 5 5
 5 2 2
 5 2 2

13:
 1 1 6
 5 3 2
 5 3 2

14:
 2 2 2
 5 3 3
 5 3 3

15:
 3 2 2
 1 4 4
 6 3 3

16:
 3 3 2
 2 0 5
 6 4 3

17:
 3 3 3
 3 1 1
 6 4 4

18:
 4 3 3
 4 1 1
 2 5 5

19:
 4 4 3
 4 2 1
 3 1 6

20:
 4 4 4
 4 2 2
 4 2 2

21:
 1 0 5
 4 3 2
 4 3 2

22:
 2 1 1
 4 3 3
 4 3 3

23:
 3 1 1
 0 4 4
 5 3 3

24:
 3 2 1
 1 0 5
 5 4 3

25:
 3 2 2
 2 1 1
 5 4 4

26:
 4 2 2
 3 1 1
 1 5 5

27:
 4 3 2
 3 2 1
 2 1 6

28:
 4 3 3
 3 2 2
 3 2 2

 nscan=4
 ct=28
