You should be automatically redirected . If not, visit
http://newlisper.wordpress.com
and update your bookmarks.

21/12/2005

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

2 Comments:

At 17:26, Anonymous Sammo said...

My first pass at solutions:

(set 'zero (- 44 44))
(set 'zero (+ 4 4 (- 4) (- 4)))
(set 'zero (+ 4 4 (- (+ 4 4))))
(set 'one (/ 44 44))
(set 'one (+ (/ 4 4) (- 4 4)))
(set 'one (+ (/ 4 4) (+ 4 (- 4))))
(set 'two (/ (* 4 4) (+ 4 4)))
(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 'eight (- (+ 4 4 4) 4))
(set 'nine (+ (+ 4 4) (/ 4 4)))

P.S., I really like this blog!

 
At 21:39, Blogger newlisper said...

Well done! I can't imagine a more comprehensive set of answers!

I suspect this question is many centuries old...

 

Post a Comment

Links to this post:

Create a Link

<< Home