Created
June 30, 2011 09:48
-
-
Save basdirks/1055942 to your computer and use it in GitHub Desktop.
multiples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
multiples: (from, to, factors...) -> | |
((for x in factors | |
([from..to].filter (y) -> y % x is 0)).reduce (xs, x) -> | |
xs.concat x).sort (a, b) -> a - b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
multiples 1, 30, 6, 8
would give you
[6, 8, 12, 16, 18, 24, 24, 30]