! Copyright (c) 2007 Samuel Tardieu.
! See http://factorcode.org/license.txt for BSD license.
IN: project-euler.169
-USING: combinators kernel math math.functions memoize ;
+USING: combinators kernel math math.functions project-euler.common ;
! http://projecteuler.net/index.php?section=problems&id=169
{
{ [ dup 2 < ] [ drop 1 ] }
{ [ dup odd? ] [ 2/ fn ] }
- [ 2/ [ fn ] [ 1- fn ] bi + ]
+ [ 2/ [ fn ] [ 1 - fn ] bi + ]
} cond ;
: euler169 ( -- result )
! [ euler169 ] 100 ave-time
! 0 ms ave run time - 0.2 SD (100 trials)
-MAIN: euler169
+SOLUTION: euler169