Skip to content

Instantly share code, notes, and snippets.

@zeeshanlakhani
Forked from jeremyheiler/euler1.factor
Created April 7, 2014 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeeshanlakhani/10020736 to your computer and use it in GitHub Desktop.
Save zeeshanlakhani/10020736 to your computer and use it in GitHub Desktop.
USING: kernel math sequences ;
IN: euler1
: multiple-of ( x y -- z ) mod zero? ;
: euler1 ( x -- y )
1 - iota [ 1 + ] map
[ dup [ 3 multiple-of ] [ 5 multiple-of ] bi or [ ] [ drop 0 ] if ]
map
sum
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment