{"id":2129,"date":"2011-06-07T14:21:03","date_gmt":"2011-06-07T14:21:03","guid":{"rendered":"http:\/\/spinor.info\/weblog\/?p=2129"},"modified":"2011-06-07T14:21:03","modified_gmt":"2011-06-07T14:21:03","slug":"enigma","status":"publish","type":"post","link":"https:\/\/spinor.info\/weblog\/?p=2129","title":{"rendered":"Enigma"},"content":{"rendered":"<p>One of the things I like the least about New Scientist (which, in  many respects, is probably the best popular science magazine out there)  is the &#8220;Enigma&#8221; brainteaser. I am sure it appeals to the &#8220;oh I am ever  so smart!&#8221; Mensa member crowd out there but&#8230;<\/p>\n<p>Well, the thing is, I never liked brainteasers. Are you really  smarter than someone else because you happen to remember a random  historical factoid? Does it really make sense to ask you to complete a  series like, say, 1, 4, 9, 16, ? when the answer can be anything, as  there is no compelling reason other than psychology (!) for it to be a  homogeneous quadratic series?<\/p>\n<p>But then&#8230; sometimes brainteasers reveal more about the person  solving them than about the solution itself. I remember when I was in  the second or third grade, our teacher gave us a simple exercise: add  all the numbers from 1 to 100. (Yes, this is the same exercise given to a  young Gauss.) Like Gauss, one of my classmates discovered (or perhaps  knew already) that you can add 1+100 = 101; 2+99 = 101, 3+98 = 101, and  so on, all the way up to 50 + 51 = 101; and 50 times 101 is 5050, which  is the correct answer.<\/p>\n<p>Trouble is, my classmate didn&#8217;t finish first. I did. I just added the darn numbers.<\/p>\n<p>Between quick and smart, who wins? What if you&#8217;re so quick, you don&#8217;t  need to be smart? Is it still smart to waste brainpower to come up  with a &#8220;clever&#8221; solution?<\/p>\n<p><a href=\"http:\/\/www.newscientist.com\/article\/mg21028132.200-enigma-number-1647.html\">Last week&#8217;s New Scientist Enigma puzzle<\/a> caught my attention because it reminded me of this childhood memory. It  took me roughly a minute to solve it. Perhaps there is a cleverer way  to do it, but why waste all that brainpower when I can do this instead:<\/p>\n<blockquote>\n<pre style=\"font-size: 8pt; line-height: 100%;\">\/* New Scientist Enigma number 1647 *\/\r\n\r\n#include &lt;stdio.h&gt;\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    int d1, d2, d3, d4, d5, d6, n;\r\n\r\n    for (d1 = 1; d1 &lt;= 9; d1++)\r\n        for (d2 = 1; d2 &lt;= 9; d2++) if (d2 != d1)\r\n            for (d3 = 1; d3 &lt;= 9; d3++) if (d3 != d1 &amp;&amp; d3 != d2)\r\n                for (d4 = 1; d4 &lt;= 9; d4++)\r\n                    if (d4 != d1 &amp;&amp; d4 != d2 &amp;&amp; d4 != d3)\r\n                        for (d5 = 1; d5 &lt;= 9; d5++)\r\n                            if (d5 != d1 &amp;&amp; d5 != d2 &amp;&amp; d5 != d3 &amp;&amp; d5 != d4)\r\n                                for (d6 = 1; d6 &lt;= 9; d6++)\r\n                                    if (d6 != d1 &amp;&amp; d6 != d2 &amp;&amp; d6 != d3 &amp;&amp;\r\n                                        d6 != d4 &amp;&amp; d6 != d5)\r\n    {\r\n        n = 100000 * d1 + 10000 * d2 + 1000 * d3 + 100 * d4 + 10 * d5 + d6;\r\n\r\n        if (n % 19 != 17) continue;\r\n        if (n % 17 != 13) continue;\r\n        if (n % 13 != 11) continue;\r\n        if (n % 11 != 7) continue;\r\n        if (n % d4 != d3) continue;\r\n        printf(\"ENIGMA = %d\\n\", n);\r\n    }\r\n\r\n    return 0;\r\n}<\/pre>\n<\/blockquote>\n<p>Yes, I am quick with C. Does that make me smart?<\/p>\n<fb:like href='https:\/\/spinor.info\/weblog\/?p=2129' send='true' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida grande'><\/fb:like>","protected":false},"excerpt":{"rendered":"<p>One of the things I like the least about New Scientist (which, in many respects, is probably the best popular science magazine out there) is the &#8220;Enigma&#8221; brainteaser. I am sure it appeals to the &#8220;oh I am ever so smart!&#8221; Mensa member crowd out there but&#8230; Well, the thing is, I never liked brainteasers. <a href='https:\/\/spinor.info\/weblog\/?p=2129' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36,48],"tags":[],"class_list":["post-2129","post","type-post","status-publish","format-standard","hentry","category-programming","category-science","category-36-id","category-48-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=\/wp\/v2\/posts\/2129","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2129"}],"version-history":[{"count":7,"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=\/wp\/v2\/posts\/2129\/revisions"}],"predecessor-version":[{"id":2136,"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=\/wp\/v2\/posts\/2129\/revisions\/2136"}],"wp:attachment":[{"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}