Albert (sees May): I don't know the birthday, but Bernard might know because if it's May 19 he'd know since there's only one 19.
If June XX:
Albert (sees June): I don't know the birthday, but Bernard might know because if it's June 18, he'd know since there's only one 18.
If August 14
Albert (sees August): I don't know the birthday, but I know Bernard also doesn't know, because he either sees 14, 15, or 17. In either case, there are multiple options.
Bernard (sees 14): Albert knows I don't know, so it can't be May or June. That leaves July 14 or August 14, but I can't tell which.
If August 15
Albert (sees August): I don't know the birthday, but I know Bernard also doesn't know, because he either sees 14, 15, or 17. In either case, there are multiple options.
Bernard (sees 15): Albert knows I don't know, so it can't be May or June. There's only one other 15, which is August 15. I know the birthday!
Albert: Bernard now knows, which means he must have seen 15 or 17. But I don't know which so I still don't know the birthday.
If August 17
Albert (sees August): I don't know the birthday, but I know Bernard also doesn't know, because he either sees 14, 15, or 17. In either case, there are multiple options.
Bernard (sees 17): Albert knows I don't know, so it can't be May or June. There's only one other 17, which is August 17. I know the birthday!
Albert: Bernard now knows, which means he must have seen 15 or 17. But I don't know which so I still don't know the birthday.
If July 14
Albert (sees July): I don't know the birthday, but I know Bernard also doesn't know, because he either sees 14 or 16. In either case, there are multiple options.
Bernard (sees 14): Albert knows I don't know, so it can't be May or June. That leaves July 14 or August 14, but I can't tell which.
If July 16
Albert (sees July): I don't know the birthday, but I know Bernard also doesn't know, because he either sees 14 or 16. In either case, there are multiple options.
Bernard (sees 16): Albert knows I don't know, so it can't be May or June. There's only one other 16, which is July 16. I know the birthday!
Albert: Bernard now knows, which means he must have seen 16. Now I know the birthday as well!
Conclusion: July 16 is the only one that is consistent with the pattern of facts.
Here's how I work it out step by step.
If May XX:
If June XX:
If August 14
If August 15
If August 17
If July 14
If July 16
Conclusion: July 16 is the only one that is consistent with the pattern of facts.