Prime number generator for small number of digits
Let P be any composite number Then, P = Q x R {Q, R < P and belongs to positive integers} If Q or R composite, then by above result they can be written as product of smaller integers repeatedly until all the factors are primes. Therefore, any composite number can be written as a product of smaller primes.
Also If P is a composite P = Q x R = √P x √P {Q, R < P and belongs to positive integers} This implies, If Q ≥ √P then R≤√P and vice versa Which implies Any composite has a prime factor which is less than or equal to its square root. Because of this if any number is not divisible by the prime numbers less than its square root, it can be considered as a prime.