Last active
August 14, 2018 16:45
-
-
Save mvw/e75ddd9369fdc08c1f51f791852f030e to your computer and use it in GitHub Desktop.
This file contains 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
def dp(a, b, c) | |
a*b*c | |
end | |
def ds(a, b, c) | |
a+b+c | |
end | |
count = 0 | |
(1..9).each do |a| | |
(1..9).each do |b| | |
(1..9).each do |c| | |
if ds(a, b, c) % dp(a, b, c) == 0 | |
count+=1 | |
puts "#{count}: #{a}#{b}#{c}" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment