All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Centenarians (Posted on 2017-06-29)
Zebulon turned 100 last month. Four of his friends will turn 100 in the first four months of next year. Using the clues below, can you figure out each one's full name, date of the month and month of his birthday?

1. Charlie's birthday occurs three days earlier in its month than that of Mr. Hearst in his month. Mr. Hearst in turn will be celebrating in the month before the man whose birthday falls on the 12th of its month.
2. Dan Brown's birthday is on an earlier date of month than that of the man whose birthday is in January, but on a later date of the month than that of the man whose birthday is in April.
3. Bill's birthday comes earlier in the year than Mr. Wilson's.
Each man was born in a different one of the first four months of the year. The dates of the months are the 12th, 16th, 19th and 22nd. And one of the friends is named Alan. One of the friends (not necessarily the same one) has the last name Long.
From Large Print Logic Puzzles, Chartwell Books, New York, 2011.

 See The Solution Submitted by Charlie Rating: 3.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 program solution (turbator,interventor) Comment 1 of 1

Charlie Long, the 19th of January
Dan Brown, the 16 of February
Bill Hearst, the 22nd of March.
Alan Wilson, the 12th of April.

--------
Query
--------

| ?- solution(S).

S = [    (charlie,long,19,1),
(bill,hearst,22,3),
(dan,brown,16,2),
(alan,wilson,12,4)
]
? ;
no

----------
Program
----------

solution(A) :-
A=[(charlie,_,_,_),(bill,_,_,_),(dan,_,_,_),(alan,_,_,_)],
member((charlie,_,B,_), A),
member((_,hearst,C,D), A),
member((dan,brown,E,_), A),
member((bill,_,_,F), A),
member((alan,_,_,_), A),
member((_,wilson,_,G), A),
member((_,long,_,_), A),
member((_,_,12,H), A),
member((_,_,16,_), A),
member((_,_,19,_), A),
member((_,_,22,_), A),
member((_,_,I,1), A),
member((_,_,_,2), A),
member((_,_,_,3), A),
member((_,_,J,4), A),
B is C-3,
D is H-1,
E<I,
E>J,
F<G.

member(X,[X|_]).
member(X,[_|R]) :- member(X,R).

 Posted by ollie on 2017-06-29 14:54:55

 Search: Search body:
Forums (0)