I have 98000 5-digit numbers, from 00001 to 98000. I need to distribute these 98000 numbers in 14000 5x5 matrices.
A matrix cell must contain only a digit from 0 to 9.
Each matrix must receive 7 numbers from the 98000: one number in each line and two in the diagonals.
All 98000 numbers must be distributed in all 14000 matrices, without repetition.
The distribution can't feel like it is sequential, it must appear "random".
Here is an example:
0 1 2 3 0
7 6 5 4 3
0 0 8 1 2
3 7 5 6 0
4 5 5 0 0
Line 1: Number 01230
Line 2: Number 76543
Line 3: Number 00812
Line 4: Number 37560
Line 5: Number 45500
Main Diagonal (from top-left to bottom-right): 06860
Secondary Diagonal (from bottom-left to top-right): 47840
Another example:
3 9 4 0 5
1 3 2 0 9
0 0 0 0 1
9 7 4 5 4
1 2 7 7 8
Line 1: Number 39405
Line 2: Number 13209
Line 3: Number 00001
Line 4: Number 97454
Line 5: Number 12778
Main Diagonal (from top-left to bottom-right): 33058
Secondary Diagonal (from bottom-left to top-right): 17005
Is it mathematically possible? I mean, one can distribute all 98000 numbers in 14000 matrices without repetition? If it is, how can I write an algorithm to do the distribution?
I tried to write a program in C# to do this task, but I couldn't find a good strategy to do it. My program always try to fill a number which was already filled.
Thanks in advance!
(Cross-post on stackoverflow)