That Blue Square Thing

Puzzles 4b – prime numbers

Prime numbers are numbers that are only divisible by themselves and 1, not by any other number.

So, the first few prime numbers are 2, 3, 5, 7, 11, 13, 17 etc...

If the HCF of two or more numbers comes back as 1 then one or more of the numbers might be a prime number.

But not necessarily. So, the HCF of 16 and 15 is 1, but neither 16 or 15 are prime numbers.

First off, remember that 1 is not a prime number. So if one of the numbers are 1 then it can't be a prime.

Coding this in Python is pretty tricky, so here's a routine you can use to check for prime numbers. It has comments in it to help explain what happens.

Copy the code from the text file and paste it into a new Python program.

Text file iconPrime checker code

You'll probably still need a hand on how best to use this...