Skip to content

Instantly share code, notes, and snippets.

@sjwiesman
Created March 14, 2016 19:01
Show Gist options
  • Save sjwiesman/d93da6c5e259b2f7c030 to your computer and use it in GitHub Desktop.
Save sjwiesman/d93da6c5e259b2f7c030 to your computer and use it in GitHub Desktop.
def rule(num: Long) = (1 to 10).map(digit => (num / Math.pow(10, 10 - digit).toInt) % digit).forall(_==0)
"123456789".permutations.map(number => number ++ "0").map(_.toLong).filter(rule)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment