Christmas Quiz by Newlisper

Started by Sammo, December 21, 2005, 11:08:57 AM

Previous topic - Next topic

Sammo

Because I can't figure out how to leave a comment at http://newlisper.blogspot.com">http://newlisper.blogspot.com, I'll post my answers here:



Newlisper's problem statements is:
Quote
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:
Quote(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)))

newdep

#1
hahahahahaha..... great quiz! great solution ! ;-)
-- (define? (Cornflakes))