Created
October 21, 2012 21:31
-
-
Save dclements/3928583 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
@tailrec | |
private def eulerTotient(f: List[Tuple2[LargeInt, Int]], retval: Rational): LargeInt = { | |
f match { | |
case Nil => retval.dividend | |
case ::(h, t) => | |
eulerTotient( | |
t, | |
retval * Rational(h._1 - LargeInt.One, h._1) | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment