fork download
  1. object Main extends App {
  2.  
  3.  
  4. def dummy(n:Int, x:Int, y:Int):Int = {
  5. (for(a <- x to y if a%n==0) yield 1).sum
  6. } //> dummy: (n: Int, x: Int, y: Int)Int
  7.  
  8. def smart(n:Int, x:Int, y:Int):Int = {
  9. y/n - (x-1)/n
  10. } //> smart: (n: Int, x: Int, y: Int)Int
  11.  
  12. for(n<- 1 to 20; x <- 1 to 50; y <- x to 60 if smart(n,x,y) != dummy(n,x,y)){
  13. println((n,x,y)+" "+smart(n,x,y)+" "+ dummy(n,x,y))
  14. }
  15. }
  16.  
Success #stdin #stdout 0.5s 382016KB
stdin
Standard input is empty
stdout
Standard output is empty