Fact: All teachers of mathematics will have taught about prime numbers at some time. A lot of teachers of computer science will have assigned the problem of determining whether or not a number input is prime or not.
It’s a relatively straight forward concept. A number is prime if:
So, just about every positive number is either prime or composite.
The site number.education has just about everything you’d ever want to know about Prime Numbers in one spot, as well as a way to test to see if any number is prime.
All of this is accessible via the menu on the landing site.
I’ve long known about prime numbers. It’s just one of those things that you learn early in school and it sticks with you. It’s also a nice time waster to start with 3 and see how far you can go in your head, picking off prime numbers.
From a computer science perspective, it really is an interesting concept. The mathematics is so simple and you can introduce/reinforce many programming concepts by writing a program or two. Integer division, remainders, test for valid input, etc.
Yes, these are slow times so I did write a couple of programs here just for old times sake.
Oh, and there is one positive number that isn’t prime. This page catches it nicely and so should your program, if you elect to write one.