Paste: Euler 1 and 2

Author: missingfaktor
Mode: factor
Date: Wed, 28 Dec 2011 05:47:47
Plain Text |
! Problem #1
USE: 
1000 iota [ 
  { [ 3 divisor? ] [ 5 divisor? ] } 1|| 
] filter sum

! Problem #2
USE: fry
: million ( n -- n' ) 1000000 * ;
: fibonacci ( upto -- fib ) 0 1 rot '[ dup _ < ] [ swap over + dup ] produce 2nip but-last ;
4 million fibonacci [ even? ] filter sum

New Annotation

Summary:
Author:
Mode:
Body: