Paste: Generate fibonacci series

Author: max
Mode: factor
Date: Wed, 15 Feb 2012 22:05:45
Plain Text |
IN: fibo
USING: math kernel sequences locals prettyprint ;

: next-fib ( x y -- y x+y ) swap over + ;
:: fib-produce ( max -- seq ) 1 1 [ next-fib dup max <= ] [ dup ] produce 2nip ;

4000000 fib-produce [ even? ] filter sum .

New Annotation

Summary:
Author:
Mode:
Body: