Mathematics has many interesting numbers with special properties. One of these types is called prime numbers. Prime numbers have fascinated…