mirror of
https://bitbucket.org/Mattrixwv/my-classes.git
synced 2025-12-06 18:23:57 -05:00
Adjusted variable names
This commit is contained in:
@@ -175,15 +175,15 @@ std::vector<T> getNumPrimes(T numberOfPrimes){
|
||||
|
||||
//This function determines whether the number passed into it is a prime
|
||||
template <class T>
|
||||
bool isPrime(T num){
|
||||
if(num <= 3){
|
||||
return num > 1;
|
||||
bool isPrime(T possiblePrime){
|
||||
if(possiblePrime <= 3){
|
||||
return possiblePrime > 1;
|
||||
}
|
||||
else if(((num % 2) == 0) || ((num % 3) == 0)){
|
||||
else if(((possiblePrime % 2) == 0) || ((possiblePrime % 3) == 0)){
|
||||
return false;
|
||||
}
|
||||
for(T cnt = 5;(cnt * cnt) <= num;cnt += 6){
|
||||
if(((num % cnt) == 0) || ((num % (cnt + 2)) == 0)){
|
||||
for(T cnt = 5;(cnt * cnt) <= possiblePrime;cnt += 6){
|
||||
if(((possiblePrime % cnt) == 0) || ((possiblePrime % (cnt + 2)) == 0)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user