How would you program this?

Bill Mill bill.mill at
Thu Mar 3 21:32:36 CET 2005

On Thu, 03 Mar 2005 10:52:23 -0800, engsol <engsolnorm at> wrote:
> The diagonal constraint is seems to affect the number of
> solutions. One surprise, (not being a math major), was that when I let the
> brute force run (forever, it seemed), but without the diagonal qualification(s),
> there was maybe 100 solutions. The reson it was a surprise it that years
> ago a programmer used the row-sum, col-sum method to detect and correct
> data errors. He swore it was robust, and 100% reliable. Seems that that
> isn't the case.

I think that it probably is a decent gut-check for data errors, for
the simple reason that changing one number requires, at a minimum,
three other changes in order to maintain both the row and column sums.
If you have at least a decent data fidelity rate, that is unlikely to
happen, and even if it does, very very unlikely to happen in such a
way that the row and column sums are maintained; especially as the
number of rows and columns grows.

Better to just do a crc or a hash of the data though.

Bill Mill
bill.mill at

More information about the Python-list mailing list