object PrimeNumberGame extends App { val N = args(0).toInt val primeNumbers = sieve(Seq.range(2, N), Seq.empty) println(s"${if((N - primeNumbers.last) < 2) "Lose" else "Win"}") def sieve(numbers: Seq[Int], result: Seq[Int]): Seq[Int] = { if(numbers.length == 1) result :+ numbers.head else sieve(numbers.filter(_ % numbers.head != 0), result :+ numbers.head) } }