Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Are the following condition sufficient for checking if solution of Sudoku with (extended output) is valide :

  • sum of values in each row, column and subsquare is equal to 45 and
  • sum of squares of values in each row, column and subsquare is equal to 285

By extended output I mean that the error could be made, such that each value could be from range <-1000,1000> for example. As you see it is some kind of generalization of possible output of sudoku, but rules of Sudoku are unchanged.

If you need additional information or want to know my motivation please ask.

share|improve this question
    
ok I have not answer but information that make my question invalide math.stackexchange.com/questions/157682/… my condition could be substituted by taking sums of 2^value, but I'm not sure on 100% –  Qbik Mar 11 '13 at 22:25
1  
Yes, as shown in the question you link to, if you check all rows, columns, and subsquares with the $2^{k-1}$ weighting and get $511$ each time, you have a valid Sudoku. –  Ross Millikan Mar 11 '13 at 22:33

2 Answers 2

up vote 1 down vote accepted

In other words, you are asking whether there exists any set of 9 integers

$a\le b\le c\le d\le e\le f\le g\le h\le j$

such that

$a+b+c+d+e+f+g+h+j = 45$

and simultaneously

$a^2+b^2+c^2+d^2+e^2+f^2+g^2+h^2+j^2 = 285$

other than the trivial solution $1,2,3,4,5,6,7,8,9$.

In Mathematica, that's

FindInstance[
    a^2 + b^2 + c^2 + d^2 + e^2 + f^2 + g^2 + h^2 + j^2 = 285
        && a + b + c + d + e + f + g + h + j = 45,
    {a,b,c,d,e,f,g,h,j},
    Integers
]

but I don't have access to Mathematica so I don't know what it'd come up with.

A trivial computer program can find all the answers easily, though, because of that second equation. We know that all the $x^2$s are positive quantities, so none of the $x$s can possibly be outside the range $[-16,16]$.

int main()
{
 for (int a=-16; a <= 16; ++a) {
  for (int b=a; b <= 16; ++b) {
   for (int c=b; c <= 16; ++c) {
    for (int d=c; d <= 16; ++d) {
     for (int e=d; e <= 16; ++e) {
      for (int f=e; f <= 16; ++f) {
       for (int g=f; g <= 16; ++g) {
        for (int h=g; h <= 16; ++h) {
         for (int j=h; j <= 16; ++j) {
          if (a+b+c+d+e+f+g+h+j != 45) continue;
          if (a*a + b*b + c*c + d*d + e*e + f*f + g*g + h*h + j*j != 285) continue;
          printf("%d %d %d %d %d %d %d %d %d\n", a,b,c,d,e,f,g,h,j);
         }
        }
       }
      }
     }
    }
   }
  }
 }
}

This program takes six-tenths of a second to run on my MacBook Pro, and finds 80 distinct solutions:

-2 4 6 6 6 6 6 6 7
-2 5 5 5 6 6 6 7 7
-1 2 5 6 6 6 7 7 7
-1 2 6 6 6 6 6 6 8
-1 3 4 5 6 6 7 7 8
-1 3 5 5 5 6 6 8 8
-1 3 5 5 6 6 6 6 9
-1 4 4 4 5 7 7 7 8
-1 4 4 4 6 6 6 8 8
-1 4 4 5 5 5 7 8 8
-1 4 4 5 5 6 6 7 9
0 1 4 6 6 7 7 7 7
0 1 5 5 6 6 7 7 8
0 2 3 5 6 7 7 7 8
0 2 3 6 6 6 6 8 8
0 2 4 4 6 6 7 8 8
0 2 4 5 5 6 7 7 9
0 2 5 5 5 5 6 8 9
0 3 3 4 5 7 7 8 8
0 3 3 4 6 6 7 7 9
0 3 3 5 5 5 8 8 8
0 3 3 5 5 6 6 8 9
0 3 4 4 4 6 8 8 8
0 3 4 4 4 7 7 7 9
0 3 4 4 5 5 7 8 9
0 3 4 4 6 6 6 6 10
0 3 4 5 5 5 6 7 10
0 4 4 4 4 6 6 7 10
0 4 4 4 5 5 5 9 9
1 1 3 5 6 6 7 8 8
1 1 3 6 6 6 6 7 9
1 1 4 4 5 7 7 8 8
1 1 4 4 6 6 7 7 9
1 1 4 5 5 5 8 8 8
1 1 4 5 5 6 6 8 9
1 1 5 5 5 6 6 6 10
1 2 2 4 7 7 7 7 8
1 2 2 5 5 7 7 8 8
1 2 2 5 6 6 7 7 9
1 2 3 3 6 7 7 8 8
1 2 3 4 5 6 7 8 9
1 2 3 5 5 6 6 7 10
1 2 4 4 5 5 6 9 9
1 2 4 4 5 5 7 7 10
1 2 4 5 5 5 5 8 10
1 3 3 3 4 7 8 8 8
1 3 3 3 6 6 6 7 10
1 3 3 4 4 5 8 8 9
1 3 3 4 4 6 6 9 9
1 3 3 4 4 6 7 7 10
1 3 3 4 5 5 6 8 10
1 3 4 4 4 4 7 9 9
1 3 4 4 5 5 6 6 11
1 4 4 4 4 5 5 7 11
2 2 2 3 6 6 8 8 8
2 2 2 3 6 7 7 7 9
2 2 2 4 4 7 8 8 8
2 2 2 4 6 6 6 7 10
2 2 2 5 5 5 6 9 9
2 2 2 5 5 5 7 7 10
2 2 3 3 4 7 7 8 9
2 2 3 3 5 5 8 8 9
2 2 3 3 5 6 6 9 9
2 2 3 3 5 6 7 7 10
2 2 3 4 4 5 7 9 9
2 2 3 4 4 6 6 8 10
2 2 3 5 5 5 6 6 11
2 2 4 4 4 4 7 8 10
2 2 4 4 4 6 6 6 11
2 2 4 4 5 5 5 7 11
2 3 3 3 3 6 8 8 9
2 3 3 3 4 5 7 8 10
2 3 3 3 5 6 6 6 11
2 3 3 4 4 5 5 9 10
2 3 3 4 4 5 6 7 11
2 4 4 4 4 4 4 8 11
3 3 3 3 4 4 6 9 10
3 3 3 4 4 4 5 8 11
3 3 4 4 4 5 5 5 12
3 4 4 4 4 4 4 6 12
share|improve this answer

By extended output you mean integers right?

Otherwise the equations $x+y+z =45$ and $x^2+y^2+z^2=285$ have real solution see here.

share|improve this answer
    
yes integers hjk,hj –  Qbik Mar 11 '13 at 22:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.