Created
August 25, 2017 14:56
-
-
Save hyuki0000/a9670b7a7b42554412e0111903635fc8 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
(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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cf. https://twitter.com/jmitani/status/901083528611323909
cf. https://twitter.com/hyuki/status/901095403415756800