Skip to content

Instantly share code, notes, and snippets.

@dclements
Created October 21, 2012 21:31
Show Gist options
  • Save dclements/3928583 to your computer and use it in GitHub Desktop.
Save dclements/3928583 to your computer and use it in GitHub Desktop.
@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