Created
April 27, 2017 06:24
-
-
Save mame-n/e805b5e2a083ab86f140d636b2904812 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 body( d ) | |
d.downto(2).inject( Rational(0,1) ) do |fin, denominator| | |
value = Rational( 3 * denominator / 7, denominator ) | |
value > fin && value != Rational( 3, 7 ) ? value : fin | |
end | |
end | |
p body( 1000000 ).numerator |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment