Page 1 of 1

Christmas Quiz by Newlisper

Posted: Wed Dec 21, 2005 7:08 pm
by Sammo
Because I can't figure out how to leave a comment at http://newlisper.blogspot.com, I'll post my answers here:

Newlisper's problem statements is:
Christmas quiz: four by four

Here's a version of a traditional puzzle to exercise your mental maths muscles before Christmas. In newLISP, define symbols zero through nine that evaluate to their integer equivalents. In other words, define symbols so that you can type this into a newLISP console:

> zero one two three four five six seven eight nine

and get the answer:

0 1 2 3 4 5 6 7 8 9

However, the restrictions are that you cannot use any digits other than 4, and you must use four 4s, no fewer and no more. You can also use all the arithmetic operators (and parentheses, obviously).

To get you started, here's the easiest one - zero:

(set 'zero (- 44 44))
My solutions are:
(set 'zero (- 44 44))
(set 'zero (+ 4 4 (- 4) (- 4)))
(set 'one (/ 44 44))
(set 'two (/ (* 4 4) (+ 4 4)))
(set 'two (+ (/ 4 4) (/ 4 4)))
(set 'three (/ (+ 4 4 4) 4))
(set 'four (+ 4 (* 4 (- 4 4))))
(set 'five (/ (+ 4 (* 4 4)) 4))
(set 'six (+ 4 (/ (+ 4 4) 4)))
(set 'seven (- (/ 44 4) 4))
(set 'seven (- (+ 4 4) (/ 4 4)))
(set 'eight (/ (* 4 (+ 4 4)) 4))
(set 'eight (- (* 4 4) (+ 4 4)))
(set 'nine (+ (+ 4 4) (/ 4 4)))

Posted: Wed Dec 21, 2005 8:15 pm
by newdep
hahahahahaha..... great quiz! great solution ! ;-)