A lot about prime

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:

From https://www.mathsisfun.com

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.

Author: dougpete

The content of this blog is generated by whatever strikes my fancy at any given point. It might be computers, weather, political, or something else in nature. I experiment and comment a lot on things so don't take anything here too seriously; I might change my mind a day later but what you read is my thought and opinion at the time I wrote it! My personal website is at: http://www.dougpeterson.ca Follow me on Twitter: http://www.twitter.com/dougpete I'm bookmarking things at: http://www.diigo.com/user/dougpete

One thought on “A lot about prime”

Comments are closed.