login
A343558
Irregular triangle read by rows: the n-th row gives the row indices of the consecutive elements of the spiral of the n X n matrix defined in A126224.
2
1, 1, 1, 2, 2, 1, 1, 1, 2, 3, 3, 3, 2, 2, 1, 1, 1, 1, 2, 3, 4, 4, 4, 4, 3, 2, 2, 2, 3, 3, 1, 1, 1, 1, 1, 2, 3, 4, 5, 5, 5, 5, 5, 4, 3, 2, 2, 2, 2, 3, 4, 4, 4, 3, 3, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 6, 6, 6, 6, 6, 5, 4, 3, 2, 2, 2, 2, 2, 3, 4, 5, 5, 5, 5, 4, 3, 3, 3, 4, 4
OFFSET
1,4
EXAMPLE
The triangle begins
1
1 1 2 2
1 1 1 2 3 3 3 2 2
1 1 1 1 2 3 4 4 4 4 3 2 2 2 3 3
...
MATHEMATICA
a:={}; nmax:=6; For[n=1, n<=nmax, n++, For[s=1, s<=2n-1, s++, If[OddQ[s] &&Mod[s, 4]==1, k=Ceiling[s/4]; For[i=1, i<=Ceiling[n-s/2], i++, AppendTo[a, k]], If[EvenQ[s]&&Mod[s, 4]==2, For[i=1, i<=Ceiling[n-s/2], i++, AppendTo[a, k+i]]; k+=Ceiling[n-s/2], If[EvenQ[s]&&Mod[s, 4]==0, For[i=1, i<=Ceiling[n-s/2], i++, AppendTo[a, k-i]]; k=k-i+1, For[i=1, i<=Ceiling[n-s/2], i++, AppendTo[a, k]]]]]]]; a
CROSSREFS
Cf. A000290 (row length), A002265, A002411 (row sums), A010873, A060747, A126224, A343559 (column indices).
Sequence in context: A047070 A071127 A029381 * A297877 A027926 A114730
KEYWORD
nonn,look,tabf
AUTHOR
Stefano Spezia, Apr 19 2021
STATUS
approved