Step-by-step solution for Prime Time
View the challenge

This challenge requires you to determine if a given number is a prime number which means it is only divisible by 1 and itself. The first few primes are: 2, 3, 5, 7, 11, ... To solve this challenge, we'll create a loop that will run from the number 2 to N checking if N is evenly divisible by any number in the list. If N is divisible by some number it means that there is no remainder, so we'll be using the modulo function for this challenge. For example: if N = 9 we start a loop from 2 to 8 9 / 2 gives a remainder of 1 9 / 3 gives a remainder of 0 which means 9 is not a prime!

You need to be a member to see the rest of this solution and code.