Author: | m |
---|---|
Mode: | factor |
Date: | Thu, 12 Aug 2010 14:19:43 |
USING: kernel locals make math math.order math.parser math.ranges sequences ; IN: problem4 : pali? ( x -- ? ) dup reverse = ; : num-pali? ( x -- ? ) number>string pali? ; :: make-range ( a b -- seq ) [ a b [a,b] [| x | a b [a,b] [| y | t [ x y * , ] when ] each ] each ] { } make ; : problem4 ( -- n ) 100 999 make-range [ num-pali? ] filter 0 [ max ] reduce ;