Testing and Finding Prime Numbers

Braincycle

Prime numbers are numbers can only be divided by itself and 1.  They are greater than 0. In this text, we will see how to test whether a number is a prime number or not. Furthermore, we will find prime numbers up to N. ( N is a number entered by user. )

For example,  2 can be divided by 2 and 1. So it is a prime number.

Prime numbers: 2, 3, 5, 7, 11 ,13, 17, 19, …

How to test a number ?

“A” is a positive number greater than 1. Let X be a number different than number A and 1. If we can find such a number divide A with remainder 0, A is not a prime number.

  • X can be preferred prime numbers less than square root of A. This make our program slightly faster.

A : 29 and Square root of A : 5.385164

View original post 80 more words

Author: mathtuition88

http://mathtuition88.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.