Yet another prime number related problem, and I’ve borrowed the findFactorsOf and isPrime functions from the problem 3 solution here.

The only interesting bit of code here is the primeSequence function, which generates a sequence of prime numbers equal or greater than 2, up to the specified max using a for … in loop. The for…in loop is basically the same as a foreach (var .. in ..) loop in C#.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.