Problem

Source: Czech and Slovak Olympiad 2019, National Round, Problem 6

Tags: Combinatorial Number Theory, numbers in a table, national olympiad, number theory



Assume we can fill a table $n\times n$ with all numbers $1,2,\ldots,n^2-1,n^2$ in such way that arithmetic means of numbers in every row and every column is an integer. Determine all such positive integers $n$.