A385865 Triangle read by rows where T(n,k), for 1 <= k < n, is the column number where (n-k)^2 occurs in an n X n grid filled rowwise with the numbers 1 to n^2.
1, 1, 1, 1, 4, 1, 1, 4, 4, 1, 1, 4, 3, 4, 1, 1, 4, 2, 2, 4, 1, 1, 4, 1, 8, 1, 4, 1, 1, 4, 9, 7, 7, 9, 4, 1, 1, 4, 9, 6, 5, 6, 9, 4, 1, 1, 4, 9, 5, 3, 3, 5, 9, 4, 1, 1, 4, 9, 4, 1, 12, 1, 4, 9, 4, 1, 1, 4, 9, 3, 12, 10, 10, 12, 3, 9, 4, 1, 1, 4, 9, 2, 11, 8, 7, 8, 11, 2, 9, 4, 1, 1
Offset: 2
Examples
k=1 2 3 4 5 6 n=2: 1 n=3: 1, 1 n=4: 1, 4, 1 n=5: 1, 4, 4, 1 n=6: 1, 4, 3, 4, 1 n=7: 1, 4, 2, 2, 4, 1 For n = 5, the grid is 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 The squares (n-k)^2 = {16, 9, 4, 1} are in column numbers {1, 4, 4, 1} respectively.
Crossrefs
Cf. A385866.
Programs
-
Mathematica
T[n_,k_]:=Mod[k^2-1,n]+1;Table[T[n,k],{n,0,14},{k,n-1}]//Flatten (* James C. McMahon, Jul 16 2025 *)
-
PARI
row(n) = vector(n-1, k, (k^2-1) % n + 1); \\ Michel Marcus, Jul 11 2025
Formula
T(n, k) = ((k^2 - 1) mod n) + 1.
Comments