From b5be5aa4f1774b47083777a690e044fd856d8c58 Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Sat, 13 Jun 2020 16:23:57 -0400 Subject: [PATCH] Fixed some typos --- src/main/java/mattrixwv/Algorithms.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/mattrixwv/Algorithms.java b/src/main/java/mattrixwv/Algorithms.java index 90c854d..cedc38c 100644 --- a/src/main/java/mattrixwv/Algorithms.java +++ b/src/main/java/mattrixwv/Algorithms.java @@ -37,7 +37,7 @@ public class Algorithms{ ArrayList primes = new ArrayList(); //Holds the prime numbers Boolean foundFactor = false; //A flag for whether a factor of the current number has been found - //If the numebr is 0 or negative return an empty list + //If the number is 0 or negative return an empty list if(goalNumber <= 1){ return primes; } @@ -46,7 +46,7 @@ public class Algorithms{ primes.add(2); } - //We cna now start at 3 and skipp all even numbers, because they cannot be prime + //We can now start at 3 and skip all even numbers, because they cannot be prime for(int possiblePrime = 3;possiblePrime <= goalNumber;possiblePrime += 2){ //Check all current primes, up to sqrt(possiblePrime), to see if there is a divisor Double topPossibleFactor = Math.ceil(Math.sqrt(possiblePrime)); @@ -127,7 +127,7 @@ public class Algorithms{ ArrayList primes = new ArrayList(); //Holds the prime numbers Boolean foundFactor = false; //A flag for whether a factor of the current number has been found - //If the numeber is 1, 0 or negative return an empty list + //If the number is 1, 0 or negative return an empty list if(goalNumber.compareTo(BigInteger.valueOf(1)) <= 0){ return primes; } @@ -136,7 +136,7 @@ public class Algorithms{ primes.add(BigInteger.valueOf(2)); } - //We cna now start at 3 and skipp all even numbers, because they cannot be prime + //We can now start at 3 and skip all even numbers, because they cannot be prime for(BigInteger possiblePrime = BigInteger.valueOf(3);possiblePrime.compareTo(goalNumber) <= 0;possiblePrime = possiblePrime.add(BigInteger.valueOf(2))){ //Check all current primes, up to sqrt(possiblePrime), to see if there is a divisor BigInteger topPossibleFactor = possiblePrime.sqrt().add(BigInteger.valueOf(1)); @@ -331,8 +331,7 @@ public class Algorithms{ goalNumber /= goalNumber; } - //If for some reason the goalNumber is not 1 throw an error - ///Need to add the appropriate error here + //TODO: If for some reason the goalNumber is not 1 throw an error //Return the list of factors return factors;