fork download
  1. object Main extends App {
  2. def fc(n:Int, i:Int = 2):Int =
  3. if (i*i>n) 0
  4. else if (n%i==0) fc(n/i,i)+1
  5. else fc(n,i+1)
  6.  
  7. val set=(4 to 196).filter(n => (2 to n/2).map(k => fc(k*(n-k))).min>=2).toSet
  8.  
  9. def fp(n :Int, i:Int = 2):List[(Int,Int)] =
  10. if (i*i>n) Nil
  11. else if (n%i==0 && set.contains(i+n/i)) (i,n/i) :: fp(n,i+1)
  12. else fp(n,i+1)
  13.  
  14. val map=(4 to 99*99).map(fp(_)).filter(_.length==1).groupBy(el => el.head._1+el.head._2)
  15.  
  16. println(map.filter(_._2.length==1).head._2(0)(0))
  17. }
Success #stdin #stdout 0.48s 322176KB
stdin
Standard input is empty
stdout
(4,13)