Christmas Quiz by Newlisper

For the Compleat Fan
Locked
Sammo
Posts: 180
Joined: Sat Dec 06, 2003 6:11 pm
Location: Loveland, Colorado USA

Christmas Quiz by Newlisper

Post 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)))

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

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

Locked