Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is a neat puzzle but you really don't need prolog. Spend a couple minutes thinking about it and you can solve this just fine.

Your question: It just means they have both green shoes and clothes, probably.

It's aimed to confuse a model with a bunch of information you-just-don't-really-need. The trick is to fish out which hints are more important than others. The order in which you apply them matters to make the puzzle easy vs. very hard. Which things give you the most amount of 'useful' information?

Call the people p1 to p5 (p5 oldest, p1 youngest).

Start with (15). This identifies the total age as 35+51. Now combine in (14), and you have 51 - 24 = 27 remaining years. This means the 35-yo is the oldest person, p5 = 35. Now add in the interesting thing that D = B+5. If you know that there is 27 years left to give to the two unknowns, B can't be 30 (or, D can't be p5). That means that D is 17 and B is 12 or D is 12 and B is 7.

This leaves three possible answers for the list of ages. Two of these are 7, 12, 12, 20, 35, or 10,12,12,17,35. The third one involves the case where the people other than the 12-year-olds and the 35-year-old are 5 years apart, in which case they can only be 11 and 16.

Combining all the 'stands-next-to' information (including point 2 which means D is to the right of B), we have eight possible orders: (AB)E(CD) or (AB)(CD)E. The last set of four is the only valid possible one as we know that D is not the eldest, which means E is 35. If the order is BADCE then B=7, A&D are 12, C=20, E=35. If the order is ABCDE then A=10,B=12,C=12,D=17,E=35 There's also the possibility that the 27 is made up of B and A (BACDE) are 11 and 16, and you are left with B=11,A=12,C=12,D=16,E=35. There is the possibility of the order being ABEDC. However, this carries no real consequences other than the clothing and shoes needing to be shuffled later. There's still only one possible value for the age of D. I'll leave the explanation for that variant out of the rest of the solution, the logic is roughly the same just with the clothes and country all juggled up.

Now one thing that's kind of unclear though is point (15). "One Adult". You'd need the definition of 'adult' to be a bit more precise (varies by country!), and also what kind of English is used to know if this implies there are at least 2 adults. If it does, then there is only one answer: D is always 12, since you need the 20-year-old to exist to have more than one adult.

If not, then D could be either 12 or 16 or 17, so the answer (so far) is 12x16x17 = 204x16=1224.

Now let's deal with the clothing, country, and shoes. All we need is that A is from Morocco, and that the second person is from South Africa. You can't simultaneously be from both places, which means A can't be in the second position.

That also clears up the ambiguity whether the 17 year old is an adult here (apparently they are), so that leaves only one possible combination: A,B,C,D,E, being 10,12,12,17,35. The answer to the question is 17.

Bonus: There's some extra stuff about countries and clothes: we have to check if there exist a valid solution that will fit with our one test. You could assume that the puzzle has an answer, but sneakily: that answer could be zero. If there are no solutions, there are no possible ages C could have, and so the answer is zero (or 1,depending on how you interpret the math of multiplying the empty set) . Here's one order that's possible (there's more, I'll leave it as an exercise to find the others):

Person: Country, Clothes, Shoes A(10): Morocco, Unknown, Red, B(12): South Africa, White, Orange C(12): Chile, Blue, Yellow D(17): Unknown, Green, Green E(35): Vanuatu, Yellow, Teal

(6) is the only point that's maybe a bit debatable? It's not true since the person wearing the teal shoes IS from vanuatu.

If this isn't valid solution for (6)... then there are no solutions, and the answer is actually 0. I'd go with 17 though, it seems fine.



> The answer to the question is 17

Except, according to the linked paper, the answer to the question is 420.

I got to 420 too, but only by ignoring almost all clues: https://news.ycombinator.com/item?id=49271594

A puzzle where nearly all clues are badly defined or irrelevant is not really a puzzle.




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

Search: