How many squares can you see?

Only 12% of people got the right answer to this puzzle. I know this because I pulled the data out of the facebook comments and analysed it myself. This is what this blog post details. So, answer it yourself before reading on because the answer’s in bold if you scroll past the image. Spoiler alert.

I saw this image and caption on facebook recently:

Everyone here at my place is talking about this right now.
The best answer we have is 24. How many squares do you see?

I like these sort of puzzles, so I spent a few seconds enumerating all possible combinations, double checked and went to post a comment to that effect. I then saw that it had 40926 comments, and I was surprised to see that none of the ones I could see on screen had the right answer, so I decided to pull out some data from the comments to see what the answer-space looked like. I was very surprised by the results.

First of all, the answer is: there are 40 squares. We don’t count the JPG artefacts (though some commenters thought it was a trick question and you had to count the artefacts too, which is quite funny really).

Anyway here are the results:

I analysed approx 10% of the answers, because I couldn’t be bothered to click “load more comments” a bajillion times. I think 10% is enough to be representative, but if you want to send me (email) a comma separated list of all 40k answers I’ll happily re-run the analysis and give you credit for being more obsessive than me, you great big nerd.

So the sample size is: 3959, of which 474 were correct (12%). The correct answer was also the most common in the data (yay crowdsourcing), although the average worked out at 32.

The methodology was pretty simple (as most things are when you’re standing on the shoulders of giants). I loaded as many comments as I could be bothered to, highlighted the text and pasted it raw into Komodo, where it looked like this (surnames redacted):

Sandy ‎38
3 minutes ago · Like
Carol How about 26 if you count the two smaller ones that contain 4 squares each?
3 minutes ago · Like
Jennifer  i got 35
3 minutes ago · Like

Then it took a few regexes to clean the data. The problem was that some people wrote multi-line comments, or comments that contained more than one set of numbers (eg Carol’s comment in the section above), so I couldn’t just pull out all the digits. There are lots of ways of doing this if you’re happy with regex string processing. It took about ten successive regexes to get me to this:


Which could then be pasted into some quickly-whipped-up NodeJS code as an array:

This code is fairly simple; I decided to deal with things like Carol’s “264″ by simply taking the first two digits, on the assumption that most multi-numeric comments would be of the form “the answer is NN, because N times N is N” and so on. I could just as easily have ignored any answers that were not two digits; ideally the sample size will be big enough for this edge case to not really matter.

The node mode code is modified from a stackoverflow answer because I’m a no-good lazy copypaste coder. Also: node mode code :)

That’s about it really. Raw answer data is here if you want to do your own analysis (please, someone do something awesome with this and let me know!). Raw output from the script was:

Num: 3959, Correct:474 (12%), Min: 1, Max: 81, Mode: 40, Avg: 32

One other thing I found interesting was that my approach was a brute-force enumeration, while my friend used the awesome power of maths in his answer:

4^2 + 3^2 + 2^2 + 1 + 2(2^2 + 1) = 40

Just goes to show that there’s more than one way to skin a cat.

Related Posts:

, ,

  1. #1 by Mike Hall on August 22, 2012 - 7:23 pm

    Got it right! Result.

    • #2 by Howard Yeend on August 22, 2012 - 7:31 pm

      You might not be smarter than a ten year old, but you can confidently say you’re smarter than >87% of facebook users.

  2. #3 by Anonymous on August 26, 2012 - 5:07 pm

    I get 41. I break it down by squares sizes.
    1×1 = 18
    2×2 = 10 (don’t forget the one in the center)
    3×3 = 4
    4×4 = 1
    and then those 8 mini squares for a total of 41…
    I might also be wrong, but you are not counting one that I am seeing.

    • #4 by John Lee on August 27, 2012 - 6:53 am

      how do you see 10 2×2′s? I only see nine including the one in the center.

  3. #5 by Anonymous on August 26, 2012 - 5:19 pm

    shoot, i was counting the one in the center twice, doh!

  4. #6 by Mike on August 27, 2012 - 6:37 am

    I think the answer is zero squares, because they are rectangles and not squares.
    I could be wrong though, since I haven’t taken any math in decades. Any thoughts?

    • #7 by Howard Yeend on August 28, 2012 - 12:47 pm

      No, they’re squares, as they are of equal width and height.

  5. #8 by Waqas Ali on September 9, 2012 - 7:12 am

    There are 26 squares.

  6. #9 by james on September 12, 2012 - 12:22 pm

    ‎1 big , 16 (1×1), 13(2×2), 4 (3×3), 8x mini, 2 x minicomposite.

    44 squares.

  7. #10 by james on September 12, 2012 - 12:41 pm

    make that 40. I got 4 2×2 squares extra earlier.

  8. #11 by david on September 24, 2012 - 2:20 am

    although there seems to be 26 or whatever the fact is the two smaller squares are cutting through so the eight big squares are not included only the eight inside the smaller ones and the four either side….making 16 squares then the big one that surrounds them all makes that a grand total of seventeen squares :)

Comments are closed.