Skip to content

Instantly share code, notes, and snippets.

@basdirks
Created June 30, 2011 09:48
Show Gist options
  • Save basdirks/1055942 to your computer and use it in GitHub Desktop.
Save basdirks/1055942 to your computer and use it in GitHub Desktop.
multiples
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
@basdirks
Copy link
Author

multiples 1, 30, 6, 8

would give you

[6, 8, 12, 16, 18, 24, 24, 30]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment