Get list of primes to N
问题 I'm trying to write a function which takes an Int and returns all of the prime numbers up to and including that Int. for example "list of primes for 8" = List(3,5,7) This is what I have so far : def isPrime(i: Int): Boolean = { if (i <= 1) false else if (i == 2) true else !(2 to (i - 1)).exists(x => i % x == 0) } //> isPrime: (i: Int)Boolean def getListOfPrimesToN(n : Int) = { } for the function getListOfPrimesToN I plan to 1. create a List "l" of size n and populate it with elements ranging