-USING: accessors arrays classes.tuple io kernel locals math
-math.functions math.ranges prettyprint project-euler.common
-sequences ;
+USING: accessors classes.tuple kernel math math.functions
+project-euler.common ranges sequences ;
IN: project-euler.064
! http://projecteuler.net/index.php?section=problems&id=64
drop drop drop ;
: try-all ( -- n )
- 2 10000 [a,b]
- [ perfect-square? not ] filter
+ 2 10000 [a..b]
+ [ perfect-square? ] reject
[ find-period ] map
[ odd? ] filter
length ;
PRIVATE>
: euler064b ( -- ct )
- 10000 [1,b] [ period odd? ] count ;
+ 10000 [1..b] [ period odd? ] count ;
SOLUTION: euler064b