Let's say we have range of positive integer numbers from a
to b
.
The task is to find all numbers in this range where square root of this number is prime number.
A prime number is a whole number greater than 1 whose only factors are 1 and itself.
A factor is a whole numbers 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.
Numbers that have more than two factors are called composite numbers.
The number 1 is neither prime nor composite.
$ cd path/to/the/prime/repo
$ g++ main.cpp && ./a.out
Please enter start of range: 1
Please enter end of range: 100
4 is prime (sqrt is 2)
9 is prime (sqrt is 3)
25 is prime (sqrt is 5)
49 is prime (sqrt is 7)