Can a 9x9 sudoku with sum 45 and sum 285 of numbers squares of (rows,collunms,3x3) not be valid

322 Views Asked by At

Its a program that check a sudoku solution if it is correct.

It checks

Rows,collums,3x3 grids if sum is 45 (1+2+3...+9=45)
Rows,collums,3x3 grids numbers in square if sum is 285 (1^2+2^2+3^2+...+9^2 = 285)

Is any way to fool that program with not a valid sudoku solution and make it think that is valid.

1

There are 1 best solutions below

0
On

Using Peters example of a vector that satifies the conditions we can easily construct a "Sudoko" that fools your algorithm

\begin{matrix} 9& 3& 6& 1& 4& 9& 4& 3& 6 \\ 1& 4& 9& 4& 3& 6& 9& 3& 6\\ 4& 3& 6& 9& 3& 6& 1& 4& 9\\ 3& 6& 1& 4& 9& 4& 3& 6& 9\\ 4& 9& 4& 3& 6& 9& 3& 6& 1\\ 3& 6& 9& 3& 6& 1& 4& 9& 4\\ 6& 1& 4& 9& 4& 3& 6& 9& 3\\ 9& 4& 3& 6& 9& 3& 6& 1& 4\\ 6& 9& 3& 6& 1& 4& 9& 4& 3 \end{matrix}