- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to check whether a number is a prime number or not?
Procedure to check whether a number is prime or not:
To check whether a number 'x' is prime or not, find the square numbers in which x lies and let us x lies between a and b then check if x is divisible by prime numbers up to square root b.
For example,
Let's take 37.
- To check whether 37 is a prime, we have to find between which square numbers 37 lies.
- 37 lies between 36(square of 6) and 49(square of 7).
- We have to check if 37 is divisible by prime numbers less than 7.
- 37 is not divisible by 2 or 3 or 5 or 7.
- Therefore, 37 is a prime number.
Advertisements