samskivert: Euler 003

09 January 2008

Problem 003:

object Euler3 extends Application {
  def lpf (divis :Long, divid :Long) :Long = {
    if (divid % divis == 0) lpf(2, divid/divis)
    else if (divis > Math.sqrt(divid)) divid
    else lpf(divis+1, divid)
  }
  println(lpf(2l, 317584931803l));
}

©1999–2022 Michael Bayne