You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
960 B
960 B
WDI-PANTHALASSA
Title: Prime numbers
Type: Morning Exercise
Creator:
Thom Page
Course: WDIr-Panthalassa
Competencies: Functions, Loops, Conditionals
PRIME NUMBERS
A Prime number is a number that is not evenly divisible by another number except 1 and itself.
To test whether a number is Prime, you only need to test as far as the square root of that number. This is advisable for optimization and testing large numbers.
STEP ONE
- Write a function called
isPrimethat will test whether a number is Prime. The function will return true if Prime, false if not.
STEP TWO
- Write another function called
primesthat will print an array of Primes up to an arbitrary limit. For example, if you invoke your function withprimes(100), it will print all the Prime numbers up to and including 100.
This function can call on the previous isPrime function.
