Skip to content

Instantly share code, notes, and snippets.

@hyuki0000

hyuki0000/curious.rb

Created Aug 25, 2017
Embed
What would you like to do?
まちがった約分なのに、なぜか正しくなる分数
(1..9).each do |a|
(1..9).each do |b|
(1..9).each do |c|
x = (10 * a + b).to_r
y = (10 * b + c).to_r
# puts "a = #{a}, b = #{b}, c = #{c}, x = #{x}, y = #{y}"
if a != c and x / y == a.to_r / c.to_r
puts "\\frac{#{x.to_i}}{#{y.to_i}} = \\frac{#{a}}{#{c}}, "
end
end
end
end
@hyuki0000

This comment has been minimized.

Copy link
Owner Author

@hyuki0000 hyuki0000 commented Sep 11, 2017

difvem_u0aeyz7b png-large

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