# Almost a sudoku puzzle

Given an $$N \times N$$ square grid, with $$N$$ is a positive integer and $$N \geq 5$$. You need to write on the square cells numbers from $$1$$ to $$4$$(some square cells can be left blank) so every row and column in the square grid have exactly 4 numbers from $$1$$ to $$4$$. Prove that: There is a solution for every positive integer $$N$$ that satisfy $$N \geq 4$$.

This is relatively easy to accomplish:

Just put 1s on the main diagonal (top left to bottom right), 2s right of every 1, 3s right of every 2, and 4s right of every 3. (When you reach the right side, wrap around to the left side.)

There's obviously one 1 per row and column. And if you look at just one of the other numbers, it's the same pattern as the 1s but shifted to the right. So there's one of each digit from 1 to 4 in every row and column.

• Once you have a solution, you can make more by reordering the rows and/or columns.
– Bass
Mar 1 '20 at 14:47

Start with @Deusovi's solution. First a vertical shift of $$5$$ (because $$5$$ is co-prime to $$12$$).

 1-3----2-4--
2-4--1-3----
3----2-4--1-
4--1-3----2-
---2-4--1-3-
-1-3----2-4-
-2-4--1-3---
-3----2-4--1
-4--1-3----2
----2-4--1-3
--1-3----2-4
--2-4--1-3--
And then a horizontal shift of $$5$$:

 1-3----2-4--
3----2-4--1-
---2-4--1-3-
-2-4--1-3---
-4--1-3----2
--1-3----2-4
2-4--1-3----
4--1-3----2-
-1-3----2-4-
-3----2-4--1
----2-4--1-3
--2-4--1-3--
although I've fudged some of the shifts to make it work!