Hacker News new | past | comments | ask | show | jobs | submit login
The 17x17 problem solved (computationalcomplexity.org)
120 points by DanielRibeiro on Feb 12, 2012 | hide | past | web | favorite | 37 comments

For those of us who are confused what "monochromatic rectangles" actually means, this article shows it perfectly:


Do I understand correctly that you can shuffle the image's rows (or columns) without losing that effect?

That would dramatically reduce the amount of computations we need to perform in order to find a match.

Basically we are looking for a system of two sets of sets of 17-bit numbers.

First set of sets is comprised of all sets of 17-bit numbers which when ANDed to each other yield a number with no more than one bit set.

Second set of sets is comprised of all sets of 17-bit numbers which do not have any common bits set.

Then from those sets we should draw a 17 4-tuples of 17-bit numbers where:

every tuple is a subset of one of the sets in the second set

every set of i-elements of tuples is a subset of one of the sets on the first set.

Sounds trivially computable on modern hardware to me! I'm sure that I'm wrong, but where?

You also need the condition that every point in the grid actually has a color. In your language that means that you have to replace your second set with:

"Second set of sets is comprised of all 4-tuples of 17-bit numbers which when ANDed together have no bits set and when ORed together have all bits set."

I don't see how this reformulation would help you solve the problem since these sets of sets are huge. You're also only exploiting the symmetries in one space direction, and you're not exploiting the symmetries in the colors. A better (and standard) way to go at it is to impose additional lexicographic ordering constraints. In addition to the constraints given by the problem you choose an ordering on the colors and add the constraint that row1 <= row 2 <= ... <= row17 where `<=` is the lexicographic ordering on 17-tuples. You do the same for columns and a similar thing for colors. That would (roughly) eliminate the following factor of grids:

      4! for the colors
    * 17! for the columns
    * 17! for the rows
    = 3.0 * 10^30
The total number of grids is:

    4^(17*17) = 9.9 * 10^173
So eliminating all those symmetries leaves us with:

    4^(17*17) / (4!17!17!) = 3.3 * 10^143
Your method only eliminates one of the 17! symmetries, so with your method you'd have to iterate over this many grids:

    4^(17*17) / 17! = 2.8 * 10^159
This is hardly trivially computable, but I'd still encourage you to try.

interestingly, the solution given is not ordered along rows or columns. http://www.cs.umd.edu/~gasarch/BLOGPAPERS/17.txt

any idea why not?

> Do I understand correctly that you can shuffle the image's rows (or columns) without losing that effect?

Yes, but a dramatic reduction in complexity still leaves a lot of complexity.

Your conditions seem to be a lot simpler than they originally appear. If I interpret you correctly, we're drawing seventeen 4-tuples of seventeen-bit numbers such that

> every tuple is a subset of one of the sets in the second set

"the elements of each tuple have no bits in common", and

> every drawn number is contained in one of sets in the first set

"each number has at most one bit set".

But there are only eighteen seventeen-bit numbers with at most one bit set, or seventeen if you exclude 0 (which seems reasonable). So isomorphically, we're trying to find seventeen 4-tuples of distinct numbers less than seventeen.

This is indeed easy (there are (17 choose 4) = 2380 of them), but I don't understand what you hope to do with these. At any rate, I don't think they particularly help solve the problem at hand.

Nope, the second condition would be "each i-number is from a set where no two numbers share more than one common bit"

You can pre-compute that set of sets (of course throwing away numbers with just 0, 1 or 2 bits set because we suspect they would slow us down without delivering) fit them in memory and then crunch the problem like a bug.

I've thrown together two simple scripts (in perl) which show that the known solution fits both of my rules. Hopefully I can write a program that would find solutions for any given NxM (or tell that no solution exists) tomorrow or something like that.

Still I suspect the solution would hit the wall because e.g. sets would be too big therefore the program would take actual ages to run, but one can surely hope?

Oh, I read AND but was doing OR. My mistake.

> Still I suspect the solution would hit the wall because e.g. sets would be too big therefore the program would take actual ages to run, but one can surely hope?

I suspect something will go wrong, and this seems to me the obvious place for it to fail. But I expect it to fail mostly based on "if it was that easy, someone would probably have noticed", not because I have any particular insight into the problem.

I have a same gut feeling, but one of my professors told us how the discoveries are being made:

Everybody know that some thing is impossible to do. But one person who didn't know that accidentally does it.

Right now I have one type-1 set having 36 numbers in it. The first numbers are 7, 25 and 42. I like it.

And the first rule would be "the elements have no bits in common, but together (ORed) they have all 17 bits" That's almost XOR(i in S) = -1 but not really

i'm sorry people vote down interesting comments like yours. please don't be discouraged by the increasing stupidity around here - i, for one, welcome an interesting viewpoint, particularly if it acknowledges that it is wrong and wants to know why...

in short: you made me stop and think. thanks.

The example they give of randomly changing one coloring and getting a whole bunch of rectangles makes me wonder if there are any points in that coloring that you could change without destroying the solution.

I doubt there are any, but it probably wouldn't take that long to write a program to check...

EDIT: And after reading this, I'm starting to wonder about other ways to use this solution to search for others, such as swapping two colors:


Took about 20 minutes to write some python code to search; takes about 1/3 of a second to try all 3x17x17 mutations and find at least one rectangle produced by each. So yeah, every single-point change "destroys" the solution.

That's interesting, last time this came around I started working though how to do it using a Sudoku style solver.

Step 1: If a solution exists it's going to have 4!(17!)^2 'mirror' images of the same solution. To avoid this problem we give each color a number and a specific ordering of the solution. Thus eliminating 4!(17!)^2 - 1 options.

Step 2: Based on the form that order takes we fill in the grid as much as possible. (Most of the top and side row).

Step 3: Start plugging in missing squares until you find contradictions. EX: If swapping a column gives a lower ordering it's not a valid solution.

"I asked them if they did it for the money (which I doubted). No, but the money made them more aware of the problem."

"The only grid that we do not know if it is 4-colorable is 12x21. This is still open and you are URGED to work on it. Sorry, no cash on this one. Do it for the glory!"

This strikes me as an excellent opportunity to use KickStarter to amplify interest. If the people interested in 12x21 kicked in even $10 each, you could have a noticeable prize. Perhaps this would be a good way to focus attention on certain problems?

I was thinking the same thing. I love the idea of using something like kick starter to publicly fund prizes for math / science, not necessarily related to 4-color rectangles.

You'd have to be careful about it, and have clear rules about who holds it and when the reward is given out. You could conceivably fund research that way as well, such as things that big business or the government shy away from, but has popular demand or value. It sounds approachable.

If the problem is not solvable, then nobody can claim the prize. I'm not really familiar with Kickstarter's rules, but I'd imagine they might take issue with a Kickstarter project where it's possible that the money can't actually be used for anything.

An excellent point, along with 'who holds the money?' and 'is the money invested in the mean time?'

I think it could be addressed with a reasonable fallback, such as a math related charity after 20 years or some such. Or if you could make it possible to start awarding 'best tempt' partial payouts.

There are certainly some complications involved, but it still seems workable to me overall. Perhaps partner with a well-known prize-giving organization.

The prize should be awarded for either finding a solution, or proving that no solution exists.

Yes. The two eventualities are equivalent for this purpose.

Obviously the non-existence of a solution might itself be unprovable, so you'd still have to set some time limit. Oh Gödel, always there to ruin our plans.

Obviously if no solution exists then that fact is also provable, since this is a finite problem. The problem is not that it might not be provable. The problem is that verifying a non-existence proof could be hard, because such a proof would probably be something like "I ran my solver for three weeks and it said that there are no solutions".

Best way of finding if there are rectangles:

> We encode the rows of the grid in a set of bit vectors–four vectors for each row, representing the four possible colors. For example, the red vector for a row has a 1 at each position where the corresponding node is red, and zeroes elsewhere. The blue vector has 1s for blue nodes, and so forth. Now we can detect a rectangle merely by taking the logical AND of two rows (an operation that could be a single machine instruction). A rectangle exists if and only if at least two bits are set in the resulting vector.

-- http://bit-player.org/2009/the-17x17-challenge

Thats some lovely hacking.

>The only grid that we do not know if it is 4-colorable is 12x21. This is still open and you are URGED to work on it.

Is this a typo for 21x21? If not, then presumably 21x21 is known to be 4-colorable...and it seem to me that removing a column from the edge* of a 4-colored grid results in another 4-colored grid (since the resulting subgrid couldn't have contained any MRs if the original grid didn't)...so a 12x21 4-colored grid should result from removing nine columns from a 21x21 such grid.

I don't actually think the above solves the problem - rather, I must be misunderstanding it. Can someone explain how?

*The column doesn't have to be from the edge, but it's a sufficient claim, and is easier to see...I couldn't be bothered to write the small proof that removing a column from the middle works.

Your argument only works if the 21x21 grid is known to be 4-colorable. But in fact, the 21x21 grid is known not to be 4-colorable.

It's also possible to mathematically prove that certain grids are not 4-colorable.

Ah, thank you. And also, duh.

Aside from being just interesting, Does this have and applications? It seems like it might have some applications in data structuring but is this just a math problem or are there actually people who are waiting on the solution?

I don't know if anyone has been waiting on this specific result for an application, but in general graph coloring has lots of applications[1]. Also, mathematical advances often predate their applications (sometimes by a very long time). Not to mention that we know something know we didn't know before, and that's always worthwhile.

[1]: http://en.wikipedia.org/wiki/Graph_coloring#Applications

Lots of discussion from when the challenge was issued a couple years back: https://news.ycombinator.com/item?id=968577

I'd really like to hear more about why this was not a trivial challenge.

Short answer: 4^(17*17) combinations to try, and each combination requires an expensive test before you can pass/fail it. Plug that number into Wolfram Alpha alongside things like "age of the universe" for some perspective on just how massive the search space is.

The search space a lot smaller, since you can cut many incorrect branches very early.

Yes, but as noted in the post mvzink linked, you can't cut it to the point that an exhaustive search is feasible.

This post explains the problem enough to give an intuitive understanding of why it's difficult: http://bit-player.org/2009/the-17x17-challenge

Tried to apply a genetic algorithm to arrive at a solution: https://gist.github.com/1820794.

Doesn't work too well just yet; maybe someone can take a look/play around with it/give me some pointers :)

Wrote this up in response to the renewed attention to the problem:

17x17 is NP-Complete: http://hackerne.ws/item?id=3584732

can someone explain me why this problem is important?

or it just happens to be another problem to be solved?

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact