Given a $n\times n$ table is it possible to fill each cell with one of the numbers $1,2,3,\cdots,n$ such that in each column,each row and each diagonal (i.e Denoting $(x,y)$ as number of column and row $(2,1)$ and $(1,2)$ form the first diagonal) every number appears exactly once? For which $n$ can we fill the table?
Context: I've been given this problem on a contest few months ago but just for $n=4,5$ which I solved easily since $n=4$ is impossible and for $n=5$ we have $$$$\begin{array}{|c|c|c|c|c|} \hline 1&2&3&4&5\\ \hline 3&4&5&1&2\\ \hline 5&1&2&3&4\\ \hline 2&3&4&5&1\\ \hline 4&5&1&2&3\\ \hline\end{array}$$$$ But I was interested in a more general statement I think I've also proved that for $n=6$ it's impossible by trying to fill the table manually. My guess is that for even $n$ it's not solvable and for odd $n$ it's solvable but I have no idea how to approach it except to fill it manually.
EDIT: For prime $n$ we can fill each cell $(i,j)$ with $i+2j\pmod{n}$ except when $i+2j\equiv0\pmod{n}$ then we write $n$ instead for example such filling with $n=7$ (the $n=5$ example is the same filling if you look at $(j,i)$ instead of $(i,j)$) $$$$\begin{array}{|c|c|c|c|c|c|c|} \hline 3&5&7&2&4&6&1\\ \hline 4&6&1&3&5&7&2\\ \hline 5&7&2&4&6&1&3\\ \hline 6&1&3&5&7&2&4\\ \hline 7&2&4&6&1&3&5\\\hline 1&3&5&7&2&4&6\\\hline2&4&6&1&3&5&7\\\hline\end{array}$$$$
PROOF OF THE EDIT: For the same row if cells $(i_1,j)$ and $(i_2,j)$ have the same value we have that $$i_1+2j\equiv i_2+2j\pmod{n}$$ implies $i_1\equiv i_2$ which is possible only if $i_1=i_2$. Same logic applies to the column for cells $(i,j_1),(i,j_2)$ we get $$i+2j_1\equiv i+2j_2\pmod{n}$$ when $n$ is prime it implies $j_1=j_2$ if $(i_1,j_1),(i_2,j_2)$ are on a diagonal we have $$|i_1-i_2|=|j_1-j_2|$$ now assuming they have the same value $$i_1+2j_1\equiv i_2+2j_2\pmod{n}$$ then $i_1-i_2\equiv 2(j_2-j_1)\pmod{n}$ which implies $1\equiv \pm 2\pmod{n}$ which is absurd.
This is not an answer but hopefully a contribution to an answer.
Double diagonal Latin squares or just diagonal Latin squares (the terminology seems to vary) are Latin squares where both main diagonals (sometimes called the main and the anti-main) also have the property that all $N$ symbols occur exactly once. I realize that your requirement is that all "minor" diagonals also don't have repeating symbols, but it should be clear that a necessary condition for this, is that the square must be a diagonal Latin square.
In this paper there is a proof on page $4$ which shows that, if there are numbers A and B from the range $[0, N-1]$ which satisfy the properties:
then you can generate a diagonal Latin square with the following rule:
Cell$(i,j) = (A * i + B * j) \mod N$
This is like the rule you found but without the strict requirement that $N$ is prime. A corollary to the above theorem is that if $N$ is an odd number not divisible by $3$, there is a diagonal Latin square of order $N$. So I tried the formula with the first odd non-prime fulfilling the corollary's requirement $(N=25)$ and got the following:
It seems to me this is a square of the type you are looking for, and with $N$ odd, but not a prime.
Edit
We can also show that with an even $N$, no diagonal Latin square can be generated using the method above. If $N$ is even, both $A$ and $B$ must be odd. But then both $(A+B)$ and $(A-B)$ must be even and can therefore not be relatively prime to $N$.
Edit 2
I made a program to generate diagonal Latin squares based on the formula above and then to check if all diagonals were without repeats. I ran the program for all odd $N$ between $3$ and $1001$ and the result is that all squares, where $N$ is not divisible by $3$, fulfilled the requirements! I therefore conjecture that the corollary above is not only true for diagonal Latin squares but also for "kingW3" squares.
Edit 3
Ladies and gentlemen, I have found a very nice document which answers many of our questions. In fact, if we use the definition of "diagonal" assumed by @Ewan Delanoy (called "broken diagonals" in the document), it basically solves the OP:
Enjoy!