mirror of
https://bitbucket.org/Mattrixwv/projecteulerjava.git
synced 2025-12-06 17:13:58 -05:00
Fixed typos
This commit is contained in:
@@ -470,11 +470,7 @@ public class Problem22 extends Problem{
|
||||
return String.format("The answer to the question is %d", sum);
|
||||
}
|
||||
//Returns the vector of the names being scored
|
||||
public ArrayList<String> getNames(){
|
||||
//If the problem hasn't been solved throw an exception
|
||||
if(!solved){
|
||||
throw new Unsolved();
|
||||
}
|
||||
public static ArrayList<String> getNames(){
|
||||
return names;
|
||||
}
|
||||
//Returns the sum of the names scores
|
||||
@@ -483,7 +479,7 @@ public class Problem22 extends Problem{
|
||||
if(!solved){
|
||||
throw new Unsolved();
|
||||
}
|
||||
return Algorithms.getLongSum(prod);
|
||||
return sum;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,19 +59,17 @@ public class Problem26 extends Problem{
|
||||
//Loop through every number from 2-999 and use it for the denominator
|
||||
for(int denominator = 2;denominator <= TOP_NUM;++denominator){
|
||||
ArrayList<Integer> denomList = new ArrayList<Integer>();
|
||||
boolean endFound = false; //Holds whether we have found an end to the number (either a cycle or a 0 for remainder)
|
||||
boolean cycleFound = false; //Holds whether a cycle was detected
|
||||
boolean endFound = false; //A flag for when we have found an end to the number (either a cycle or a 0 for remainder)
|
||||
boolean cycleFound = false; //A flag to indicate a cycle was detected
|
||||
int numerator = 1; //The numerator that will be divided. Always starts at 1
|
||||
while(!endFound){
|
||||
//Get the remainder after the division
|
||||
int remainder = numerator % denominator;
|
||||
//Check if the remainder is 0
|
||||
//If it is set the flag
|
||||
//Check if the remainder is 0 and set the flag
|
||||
if(remainder == 0){
|
||||
endFound = true;
|
||||
}
|
||||
//Check if the remainder is in the list
|
||||
//If it is in the list, set the appropriate flags
|
||||
//Check if the remainder is in the list and set the appropriate flags
|
||||
else if(Algorithms.isFound(denomList, remainder)){
|
||||
endFound = true;
|
||||
cycleFound = true;
|
||||
|
||||
@@ -32,8 +32,8 @@ import java.util.ArrayList;
|
||||
public class Problem27 extends Problem{
|
||||
//Variables
|
||||
//Static varibles
|
||||
private static int LARGEST_POSSIBLE_A = 999;
|
||||
private static int LARGEST_POSSIBLE_B = 1000;
|
||||
private static final int LARGEST_POSSIBLE_A = 999;
|
||||
private static final int LARGEST_POSSIBLE_B = 1000;
|
||||
//Instance variables
|
||||
private int topA; //The A for the most n's generated
|
||||
private int topB; //The B for the most n's generated
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//ProjectEulerJava/src/main/java/mattrixwv/ProjectEuler/Problems/Problem67.java
|
||||
//Matthew Ellison
|
||||
// Created: 03-26-19
|
||||
//Modified: 07-196-20
|
||||
//Modified: 07-19-20
|
||||
//Find the maximum total from top to bottom
|
||||
/*
|
||||
59
|
||||
|
||||
Reference in New Issue
Block a user