Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [1, 2, 3, 4, 5, 6, 7, 8, 9].permutation do |num|
- if num[0..1].to_i % 2 == 0 && num[0..2].to_i % 3 == 0 && num[0..3].to_i % 4 == 0 &&
- num[0..4].to_i % 5 == 0 &&
- num[0..5].to_i % 6 == 0 &&
- num[0..6].to_i % 7 == 0 &&
- num[0..7].to_i % 8 == 0 &&
- num[0..8].to_i % 9 == 0
- puts num.to_i
- end
- end
Add Comment
Please, Sign In to add comment