By Shaik Jilani
To find whether the entered number is a Prime Number or not a Prime Number using the Python programming language.
A Counting number is known as a prime number if it has exactly two factors and the factors are one and number itself.
Ex: Prime numbers less than 100 are:2,3,5,7,11,13,17,19,23,29,31,37,4,4,47,53,59,61,67,71,73,79,83,89,97.
Let us consider x to be a given number and y to be the smallest counting number such that y^2 >= x.
Now, test whether x is divisible by any prime numbers less than or equal to y.
If it is divisible, then x is a prime number. Otherwise, it is not a prime number.
Firstly, we take a number as input after_that we check if the number is less than or equal to 1, it is not a prime number. If it is not greater than 1, then it is not a prime number. If it is greater than 1, we check if the number is divisible by any number from 2 to (number/2)+1. If we find any factor in that range, then it is not a prime number. Otherwise, it is a prime number.