Skip to content

Instantly share code, notes, and snippets.

@mvw
Last active August 14, 2018 16:45
Show Gist options
  • Save mvw/e75ddd9369fdc08c1f51f791852f030e to your computer and use it in GitHub Desktop.
Save mvw/e75ddd9369fdc08c1f51f791852f030e to your computer and use it in GitHub Desktop.
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