TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

When Is Cheryl's Birthday?

240 pointsby jonpabout 10 years ago

19 comments

gkobergerabout 10 years ago
Maybe I'm missing something, but the "hard" part of this problem is figuring on the trick. Once you know that, it becomes relatively easy – and you can't use a program to figure out the trick.
评论 #9437335 未加载
评论 #9437483 未加载
评论 #9438228 未加载
评论 #9437524 未加载
ghurtadoabout 10 years ago
I thought this was a great puzzle when I first saw it. IMHO, it is more satisfying to &quot;think through it&quot; without paper and pencil, since it is relatively simple to resolve.<p>The Python solution proposed is really great, in that it captures both the expressive and functional spirit of the language.
评论 #9437014 未加载
vessenesabout 10 years ago
This is just beautifully expressive python. I wouldn&#x27;t think of using it this way: writing<p><pre><code> return (not know(possible_dates) and all(not know(tell(Day(d))) for d in possible_dates)) </code></pre> feels almost zen to me; or at least like Mr. Norvig likes himself some lisp at times.
评论 #9437478 未加载
评论 #9437522 未加载
ibejoebabout 10 years ago
Here&#x27;s my quick solution in modern SQL. This is more expensive than it needs to be, but doing it this way lets you see the truth table by commenting out the final predicate.<p>fiddle: <a href="http:&#x2F;&#x2F;sqlfiddle.com&#x2F;#!15&#x2F;0c419&#x2F;160&#x2F;0" rel="nofollow">http:&#x2F;&#x2F;sqlfiddle.com&#x2F;#!15&#x2F;0c419&#x2F;160&#x2F;0</a><p>gist: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;ibejoeb&#x2F;df57cb34bbe609293d6e" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;ibejoeb&#x2F;df57cb34bbe609293d6e</a>
zhte415about 10 years ago
The problem with this problem, the way it was originally put, was the utterly confusing English masked into a logic problem.<p>Write your specifications clearly, and then it does not become an internationally shared &#x27;problem&#x27; to solve.<p>[I work with insanely documented specifications just like this, year after year. Not putting a problem clearly is not something to aspire to.]
评论 #9437716 未加载
评论 #9437871 未加载
tompabout 10 years ago
For the more mathematically minded readers, here&#x27;s a harder version of the problem:<p><a href="http:&#x2F;&#x2F;jdh.hamkins.org&#x2F;transfinite-epistemic-logic-puzzle-challenge&#x2F;" rel="nofollow">http:&#x2F;&#x2F;jdh.hamkins.org&#x2F;transfinite-epistemic-logic-puzzle-ch...</a>
xarienabout 10 years ago
I&#x27;d have gone a different way since my setup and approach was a bit different (I took a more visual approach). While this solution is elegant, it&#x27;s also incredibly hard to do in the real world as it requires far too much knowledge to properly assign the &quot;correct&quot; definitions. It&#x27;s no different than having a perfect health heuristic land on your lap.<p>When I did this a while back, my approach was to construct a 5x4 matrix with blanks (5 unique dates x 4 unique months). This allowed the clues to cross off entire rows and or columns until only 1 pair stood standing. Personally, I find the construction of the solution much more interesting than the problem itself given how many people participated.
picardoabout 10 years ago
I&#x27;d be interested in seeing a solution in Prolog.
评论 #9437047 未加载
zarothabout 10 years ago
My own contribution from last week:<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=9398638" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=9398638</a><p><a href="http:&#x2F;&#x2F;opine.me&#x2F;discovering-a-new-fizzbuzz&#x2F;" rel="nofollow">http:&#x2F;&#x2F;opine.me&#x2F;discovering-a-new-fizzbuzz&#x2F;</a>
john_buttsabout 10 years ago
1. HN comment about some aspect of fizzbuzz or whatever. Not how to solve fizzbuzz or whatever; rather, some insight into how people solve problems, which is the interesting part of the question. 2. Two dozen oblivious nerds tell u how to do it in 20 characters of perl
评论 #9437827 未加载
Fandoabout 10 years ago
Maybe someone already mentioned this, but this problem is a simplified formulation of a famous number thoery riddle called &#x27;The Sum and Product Riddle&#x27; which is even more baffling. Here it is <a href="http:&#x2F;&#x2F;blog.computationalcomplexity.org&#x2F;2007&#x2F;01&#x2F;sum-and-product-riddle.html?m=1" rel="nofollow">http:&#x2F;&#x2F;blog.computationalcomplexity.org&#x2F;2007&#x2F;01&#x2F;sum-and-prod...</a>
janhaakabout 10 years ago
This is quite disturbing for me. My Aunt&#x27;s name is Cheryl. Her husband, Bernard. Guess his brother&#x27;s name!
评论 #9438208 未加载
评论 #9437444 未加载
评论 #9437710 未加载
评论 #9437445 未加载
_asummersabout 10 years ago
Where can I find more puzzles of this flavor? This generated some fun discussion on my Facebook wall.
评论 #9437321 未加载
评论 #9440558 未加载
mattbeckmanabout 10 years ago
Friend of mine wrote a Scala solution: <a href="http:&#x2F;&#x2F;www.agileatwork.com&#x2F;scala-solution-to-cheryls-birthday-problem&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.agileatwork.com&#x2F;scala-solution-to-cheryls-birthda...</a>
Nursieabout 10 years ago
If you&#x27;re puzzling over this you&#x27;ve done it wrong.<p>There is no inference from silence. There is no humanity in such a question, there is simply the information you&#x27;re given and the application of logic to narrow down the answers. The Singaporean kids that took the exam knew this and anyone that&#x27;s ever taken a maths or logic exam should know this.<p>You don&#x27;t guess what might have happened from human behaviour because you don&#x27;t know, you don&#x27;t look for a &#x27;trick&#x27; to give away the answer, you simply use the data in the question to narrow down the possibilities until you can arrive at an answer.<p>The moment you think &quot;but what if this action could have taken place because if he knew he would have said&quot; you have failed.<p>And you probably suck at debugging.
kyberiasabout 10 years ago
Couldn&#x27;t resist. This is the solution ported to C#:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;kyberias&#x2F;cherylsharp" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kyberias&#x2F;cherylsharp</a>
评论 #9438126 未加载
haddrabout 10 years ago
still looking for solution using RDF&#x2F;OWL logical reasoning...<p>the python solution is neat, but i have a feeling that there are tools that are more native to these kind of problems than general purpose programming language.
评论 #9437173 未加载
frikabout 10 years ago
Could one use Julia instead of Python?<p>&quot;iPython&quot; already supports Haskell and Julia kernels too. A iPython Javascript kernel would also make sense given its popularity and its functional inspired syntax.
评论 #9438062 未加载
andrewprockabout 10 years ago
Unfortunately, there are a number of rather curious, and culturally specific, assumptions one must make about the problem.<p>The real puzzles are:<p>1. &quot;Why did Albert speak first?&quot;<p>2. &quot;Why did he speak in such cryptic language?&quot;
评论 #9437673 未加载
评论 #9437451 未加载