Skip to content

Instantly share code, notes, and snippets.

@hyuki0000
Created August 25, 2017 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyuki0000/a9670b7a7b42554412e0111903635fc8 to your computer and use it in GitHub Desktop.
Save hyuki0000/a9670b7a7b42554412e0111903635fc8 to your computer and use it in GitHub Desktop.
まちがった約分なのに、なぜか正しくなる分数
(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
Copy link
Author

difvem_u0aeyz7b png-large

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