Determining Whether a Given Number is Prime: Exploring the Primality of Numbers

Determining Whether a Given Number is Prime: Exploring the Primality of Numbers

What is Prime Number ?

A prime number is a whole number greater than 1 whose only factors are 1 and itself and is not a product of two smaller natural numbers. A factor is a whole number that can be divided evenly into another number. The first few prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29.

What is Composite Number?

Numbers that have more than two factors are called composite numbers. The number 1 is neither prime nor composite*.*

For example, 5 is prime because the only ways of writing it as a product, 1 × 5 or 5 × 1, involve 5 itself. However, 4 is composite because it is a product (2 × 2) in which both numbers are smaller than 4.

Kotlin Program to determine primality of given number using while loop*.*

Kotlin Program to determine primality of given number using for loop*.*

Thank you for reading! Feel free to share your suggestions and comments to improve technical blogging. Your input is valued and appreciated!