mirror of
https://bitbucket.org/Mattrixwv/projecteulerpython.git
synced 2025-12-06 17:43:58 -05:00
Changed problems to work with a driver function
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,2 +1,6 @@
|
|||||||
#Visual Studio Code
|
#Visual Studio Code
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
|
#Python cache files
|
||||||
|
__pycache__
|
||||||
|
Problems/__pycache__
|
||||||
|
|||||||
174
Benchmark.py
Normal file
174
Benchmark.py
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
#ProjectEulerPython/Bechmark.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 07-19-20
|
||||||
|
#Modified: 07-19-20
|
||||||
|
#This is the driver function for the Java version of the ProjectEuler project
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from ProblemSelection import ProblemSelection
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
|
||||||
|
|
||||||
|
class Benchmark:
|
||||||
|
class BenchmarkOptions:
|
||||||
|
runSpecific = 1
|
||||||
|
runAllShort = 2
|
||||||
|
runAll = 3
|
||||||
|
exit = 4
|
||||||
|
size = 5
|
||||||
|
|
||||||
|
__tooLong = [3, 5, 10, 12, 14, 15, 23, 24, 25, 27, 30, 67]
|
||||||
|
|
||||||
|
#The driver function for the benchmark selection
|
||||||
|
@staticmethod
|
||||||
|
def benchmarkMenu():
|
||||||
|
Benchmark.printMenu()
|
||||||
|
selection = Benchmark.getMenuSelection()
|
||||||
|
|
||||||
|
if(selection == Benchmark.BenchmarkOptions.runSpecific):
|
||||||
|
Benchmark.runSpecific()
|
||||||
|
elif(selection == Benchmark.BenchmarkOptions.runAllShort):
|
||||||
|
Benchmark.runAllShort()
|
||||||
|
elif(selection == Benchmark.BenchmarkOptions.runAll):
|
||||||
|
Benchmark.runAll()
|
||||||
|
|
||||||
|
#Print the benchmark menu
|
||||||
|
@staticmethod
|
||||||
|
def printMenu():
|
||||||
|
print("1. Run a specific problem")
|
||||||
|
print("2. Run all problems that have a reasonably short run time")
|
||||||
|
print("3. Run all problems")
|
||||||
|
print("4. Exit the menu")
|
||||||
|
print()
|
||||||
|
|
||||||
|
#Returns a valid menu option
|
||||||
|
@staticmethod
|
||||||
|
def getMenuSelection() -> int:
|
||||||
|
selection = int(input(""))
|
||||||
|
while(not Benchmark.isValidMenu(selection)):
|
||||||
|
print("that is an invalid option!\nPress Enter to continue")
|
||||||
|
Benchmark.printMenu()
|
||||||
|
selection = int(input(""))
|
||||||
|
return selection
|
||||||
|
|
||||||
|
#Determines if a value is a valid menu option. Helper for getBechmarkMenuSelection
|
||||||
|
@staticmethod
|
||||||
|
def isValidMenu(selection: int):
|
||||||
|
if((selection > 0) and (selection < (Benchmark.BenchmarkOptions.size))):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
#Determines which problem user wants to run and runs it
|
||||||
|
@staticmethod
|
||||||
|
def runSpecific():
|
||||||
|
#Ask which problem the user wants to run
|
||||||
|
problemNumber = ProblemSelection.getProblemNumber()
|
||||||
|
#Ask how many times to run the problem
|
||||||
|
timesToRun = Benchmark.getNumberOfTimesToRun()
|
||||||
|
|
||||||
|
#Get the problem and print its description
|
||||||
|
problem = ProblemSelection.getProblem(problemNumber)
|
||||||
|
print(str(problemNumber) + ". " + problem.getDescription())
|
||||||
|
|
||||||
|
#Run the problem the specific number of times
|
||||||
|
totalTime = Benchmark.runProblem(problem, timesToRun)
|
||||||
|
|
||||||
|
#Print the results
|
||||||
|
print(Benchmark.getBenchmarkResults(problem, totalTime, timesToRun))
|
||||||
|
|
||||||
|
#Runs all problems except a few that are specified because of run length
|
||||||
|
@staticmethod
|
||||||
|
def runAllShort():
|
||||||
|
#Ask how many times to run the problems
|
||||||
|
timesToRun = Benchmark.getNumberOfTimesToRun()
|
||||||
|
|
||||||
|
#Run through all valid problem numbers, skipping a few that are in the tooLong list
|
||||||
|
for cnt in range(1, len(ProblemSelection.problemNumbers)):
|
||||||
|
problemNumber = ProblemSelection.problemNumbers[cnt]
|
||||||
|
|
||||||
|
#If the problem number is contained in the list of problems that take too long skip it
|
||||||
|
if problemNumber in Benchmark.__tooLong:
|
||||||
|
continue
|
||||||
|
|
||||||
|
#Get the problem and print its description
|
||||||
|
problem = ProblemSelection.getProblem(problemNumber)
|
||||||
|
print(str(problemNumber) + ". " + problem.getDescription())
|
||||||
|
|
||||||
|
#Run each problem the specified number of times
|
||||||
|
totalTime = Benchmark.runProblem(problem, timesToRun)
|
||||||
|
|
||||||
|
#Print the results
|
||||||
|
print(Benchmark.getBenchmarkResults(problem, totalTime, timesToRun))
|
||||||
|
|
||||||
|
#Runs all problems
|
||||||
|
@staticmethod
|
||||||
|
def runAll():
|
||||||
|
#Ask how many times to run the problem
|
||||||
|
timesToRun = Benchmark.getNumberOfTimesToRun()
|
||||||
|
|
||||||
|
#Run through all valid problem numbers, skipping a few that are in the tooLong list
|
||||||
|
for cnt in range(1, len(ProblemSelection.problemNumbers)):
|
||||||
|
problemNumber = ProblemSelection.problemNumbers[cnt]
|
||||||
|
|
||||||
|
#Get the problem and print its description
|
||||||
|
problem = ProblemSelection.getProblem(problemNumber)
|
||||||
|
print(str(problemNumber) + ". " + problem.getDescription())
|
||||||
|
|
||||||
|
#Run each problem the specified number of times
|
||||||
|
totalTime = Benchmark.runProblem(problem, timesToRun)
|
||||||
|
|
||||||
|
#Print the results
|
||||||
|
print(Benchmark.getBenchmarkResults(problem, totalTime, timesToRun))
|
||||||
|
|
||||||
|
#Asks how many times a problem is supposed to run and returns the value
|
||||||
|
@staticmethod
|
||||||
|
def getNumberOfTimesToRun() -> int:
|
||||||
|
numOfTimesToRun = int(input("How many times do you want to run this problem? "))
|
||||||
|
while(numOfTimesToRun < 1):
|
||||||
|
print("That is an invalid number!")
|
||||||
|
numOfTimesToRun = int(input("How many times do you want to run this problem? "))
|
||||||
|
return numOfTimesToRun
|
||||||
|
|
||||||
|
#Runs the problem the given number of times
|
||||||
|
@staticmethod
|
||||||
|
def runProblem(problem: Problem, timesToRun: int) -> float:
|
||||||
|
totalTime = 0.0
|
||||||
|
print("Solving", end='')
|
||||||
|
for cnt in range(0, timesToRun):
|
||||||
|
print('.', end = '', flush = True)
|
||||||
|
#Reset the data so you are actually count the run time an additional time
|
||||||
|
problem.reset()
|
||||||
|
#Solve the problem
|
||||||
|
problem.solve()
|
||||||
|
#Get the time data
|
||||||
|
totalTime += problem.getTimer().getNanoseconds()
|
||||||
|
return totalTime
|
||||||
|
|
||||||
|
#Prints the benchmark results of a problem
|
||||||
|
@staticmethod
|
||||||
|
def getBenchmarkResults(problem: Problem, totalTime: float, timesRun: int) -> str:
|
||||||
|
#Calculate the average run time of the problem
|
||||||
|
totalTime /= timesRun
|
||||||
|
timeResults = Stopwatch.getStr(totalTime)
|
||||||
|
|
||||||
|
#Tally the results
|
||||||
|
results = "\n\n" + problem.getResult() + "\nIt took an average of " + str(timeResults) + " to run this problem through " + str(timesRun) + " iterations\n\n"
|
||||||
|
return results
|
||||||
133
Driver.py
Normal file
133
Driver.py
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
#ProjectEulerPython/Driver.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 07-19-20
|
||||||
|
#Modified: 07-19-20
|
||||||
|
#This is the driver function for the Java version of the ProjectEuler project
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Benchmark import Benchmark
|
||||||
|
from ProblemSelection import ProblemSelection
|
||||||
|
|
||||||
|
|
||||||
|
class Driver:
|
||||||
|
#A class to hold the possible menu selections
|
||||||
|
class SELECTION:
|
||||||
|
SOLVE = 1
|
||||||
|
DESCRIPTION = 2
|
||||||
|
LIST = 3
|
||||||
|
BENCHMARK = 4
|
||||||
|
EXIT = 5
|
||||||
|
SIZE = 6
|
||||||
|
|
||||||
|
#Drives the program
|
||||||
|
@staticmethod
|
||||||
|
def main():
|
||||||
|
selection = Driver.SELECTION.SIZE #Holds the menu selection of the user
|
||||||
|
while(selection != Driver.SELECTION.EXIT):
|
||||||
|
#Print the menu and prompt the user to select an action
|
||||||
|
Driver.printMenu()
|
||||||
|
selection = Driver.getMenuSelection()
|
||||||
|
|
||||||
|
if(selection == Driver.SELECTION.SOLVE):
|
||||||
|
Driver.solveMenu()
|
||||||
|
elif(selection == Driver.SELECTION.DESCRIPTION):
|
||||||
|
Driver.descriptionMenu()
|
||||||
|
elif(selection == Driver.SELECTION.LIST):
|
||||||
|
ProblemSelection.listProblems()
|
||||||
|
elif(selection == Driver.SELECTION.BENCHMARK):
|
||||||
|
Benchmark.benchmarkMenu()
|
||||||
|
elif(selection == Driver.SELECTION.EXIT):
|
||||||
|
selection = selection
|
||||||
|
else:
|
||||||
|
Driver.printErrorMessage()
|
||||||
|
|
||||||
|
#Print the menu
|
||||||
|
@staticmethod
|
||||||
|
def printMenu():
|
||||||
|
print("1. Solve a problem")
|
||||||
|
print("2. Print a problem description")
|
||||||
|
print("3. List valid problem numbers")
|
||||||
|
print("4. Benchmark")
|
||||||
|
print("5. Exit")
|
||||||
|
print()
|
||||||
|
|
||||||
|
#Get a menu selection from the user
|
||||||
|
@staticmethod
|
||||||
|
def getMenuSelection() -> int:
|
||||||
|
selection = int(input(""))
|
||||||
|
while(not Driver.isValidMenu(selection)):
|
||||||
|
print("That is an invalid option!\nPress Enter to continue")
|
||||||
|
Driver.printMenu()
|
||||||
|
selection = int(input(""))
|
||||||
|
return selection
|
||||||
|
|
||||||
|
#Make sure the value passed in is a valid menu option
|
||||||
|
@staticmethod
|
||||||
|
def isValidMenu(selection: int) -> bool:
|
||||||
|
if((selection > 0) and (selection < (Driver.SELECTION.SIZE))):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
#Print an error message
|
||||||
|
@staticmethod
|
||||||
|
def printErrorMessage():
|
||||||
|
print("That is an invalid selection!")
|
||||||
|
|
||||||
|
#Handle what happens when a user wants to solve a problem
|
||||||
|
@staticmethod
|
||||||
|
def solveMenu():
|
||||||
|
problemNumber = ProblemSelection.getProblemNumber()
|
||||||
|
#This selection solves all problems in order
|
||||||
|
if(problemNumber == 0):
|
||||||
|
#Solve to every valid problem number, skipping over 0
|
||||||
|
for problemLocation in range(1, len(ProblemSelection.problemNumbers)):
|
||||||
|
#Solve the problem
|
||||||
|
print("\n\n" + str(ProblemSelection.problemNumbers[problemLocation]) + ". ")
|
||||||
|
ProblemSelection.solveProblem(ProblemSelection.problemNumbers[problemLocation])
|
||||||
|
print("\n\n")
|
||||||
|
#This is if a single problem number was chosen
|
||||||
|
else:
|
||||||
|
#Solve the problem
|
||||||
|
ProblemSelection.solveProblem(problemNumber)
|
||||||
|
|
||||||
|
#Handle what happens when a user wants to see the description of a problem
|
||||||
|
@staticmethod
|
||||||
|
def descriptionMenu():
|
||||||
|
#Give some extra space to print the description
|
||||||
|
print('\n')
|
||||||
|
|
||||||
|
#Get the problem number
|
||||||
|
problemNumber = ProblemSelection.getProblemNumber()
|
||||||
|
|
||||||
|
#If the problem number is 0 print out all the description
|
||||||
|
if(problemNumber == 0):
|
||||||
|
#Print description for every valid problem number
|
||||||
|
for problemLocation in range(1, len(ProblemSelection.problemNumbers)):
|
||||||
|
#Print the problem's description
|
||||||
|
print(str(ProblemSelection.problemNumbers[problemLocation]) + ". ")
|
||||||
|
ProblemSelection.printDescription(ProblemSelection.problemNumbers[problemLocation])
|
||||||
|
print()
|
||||||
|
#Otherwise print out a single problem's description
|
||||||
|
else:
|
||||||
|
ProblemSelection.printDescription(problemNumber)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
Driver.main()
|
||||||
58
Problem1.py
58
Problem1.py
@@ -1,58 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem1.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 01-26-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#What is the sum of all the multiples of 3 or 5 that are less than 1000
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
|
|
||||||
|
|
||||||
def Problem1():
|
|
||||||
#Setup your variables
|
|
||||||
fullSum = 0 #Holds the sum of all the correct numbers
|
|
||||||
|
|
||||||
#Start at 3 and start counting up, checking if any of the numbers are divisible by 3 or 5
|
|
||||||
#This method skips the problem of numbers that are divisible by both, like 15, being added twice
|
|
||||||
num = 3
|
|
||||||
while(num < 1000):
|
|
||||||
if((num % 3) == 0): #3 Will be triggered more often, putting it first makes the algorithm more efficient
|
|
||||||
fullSum += num
|
|
||||||
elif((num % 5) == 0):
|
|
||||||
fullSum += num
|
|
||||||
num += 1
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The sum of all the multiples of 3 or 5 is " + str(fullSum))
|
|
||||||
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
|
||||||
if(__name__ == "__main__"):
|
|
||||||
timer = Stopwatch() #Used to determine the algorithm's run time
|
|
||||||
timer.start() #Start the timer
|
|
||||||
Problem1() #Call the function that answers the problem
|
|
||||||
timer.stop() #Stop the timer
|
|
||||||
#Print the results of the timer
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
"""Results:
|
|
||||||
The sum of all the multiples of 3 or 5 is 233168
|
|
||||||
It took 114.142 microseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
53
Problem10.py
53
Problem10.py
@@ -1,53 +0,0 @@
|
|||||||
#Project Euler/Python/Problem10.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 01-30-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#Find the sum of all the primes below two million
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
from Algorithms import getPrimes
|
|
||||||
|
|
||||||
__numberGreaterThanPrimes = 2000000 #Get all primes <= this number
|
|
||||||
|
|
||||||
|
|
||||||
def Problem10():
|
|
||||||
#Get all of the primes < 2000000
|
|
||||||
primes = getPrimes(__numberGreaterThanPrimes - 1)
|
|
||||||
|
|
||||||
#Get the sum of the list
|
|
||||||
primeSum = sum(primes)
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The sum of all the prime numbers less than " + str(__numberGreaterThanPrimes) + " is " + str(primeSum))
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch() #Determines the algorithm's run time
|
|
||||||
timer.start() #Start the timer
|
|
||||||
Problem10() #Call the function that answers the question
|
|
||||||
timer.stop() #Stop the timer
|
|
||||||
#Print the results of the timer
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
"""Results:
|
|
||||||
The sum of all the prime numbers less than 2000000 is 142913828922
|
|
||||||
It took 5.926 seconds to run this algorithm
|
|
||||||
"""
|
|
||||||
157
Problem11.py
157
Problem11.py
@@ -1,157 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem11.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 01-31-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid?
|
|
||||||
"""
|
|
||||||
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
|
|
||||||
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
|
|
||||||
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
|
|
||||||
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91
|
|
||||||
22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80
|
|
||||||
24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50
|
|
||||||
32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70
|
|
||||||
67 26 20 68 02 62 12 20 95 63 94 39 63 08 40 91 66 49 94 21
|
|
||||||
24 55 58 05 66 73 99 26 97 17 78 78 96 83 14 88 34 89 63 72
|
|
||||||
21 36 23 09 75 00 76 44 20 45 35 14 00 61 33 97 34 31 33 95
|
|
||||||
78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92
|
|
||||||
16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57
|
|
||||||
86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58
|
|
||||||
19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40
|
|
||||||
04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66
|
|
||||||
88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69
|
|
||||||
04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36
|
|
||||||
20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16
|
|
||||||
20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54
|
|
||||||
01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48
|
|
||||||
"""
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
from Algorithms import prod
|
|
||||||
|
|
||||||
__grid = [[8, 2, 22, 97, 38, 15, 00, 40, 00, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8],
|
|
||||||
[49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 00],
|
|
||||||
[81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65],
|
|
||||||
[52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, 56, 71, 37, 2, 36, 91],
|
|
||||||
[22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80],
|
|
||||||
[24, 47, 32, 60, 99, 3, 45, 2, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50],
|
|
||||||
[32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70],
|
|
||||||
[67, 26, 20, 68, 2, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21],
|
|
||||||
[24, 55, 58, 5, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, 72],
|
|
||||||
[21, 36, 23, 9, 75, 00, 76, 44, 20, 45, 35, 14, 00, 61, 33, 97, 34, 31, 33, 95],
|
|
||||||
[78, 17, 53, 28, 22, 75, 31, 67, 15, 94, 3, 80, 4, 62, 16, 14, 9, 53, 56, 92],
|
|
||||||
[16, 39, 5, 42, 96, 35, 31, 47, 55, 58, 88, 24, 00, 17, 54, 24, 36, 29, 85, 57],
|
|
||||||
[86, 56, 00, 48, 35, 71, 89, 7, 5, 44, 44, 37, 44, 60, 21, 58, 51, 54, 17, 58],
|
|
||||||
[19, 80, 81, 68, 5, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 4, 89, 55, 40],
|
|
||||||
[4, 52, 8, 83, 97, 35, 99, 16, 7, 97, 57, 32, 16, 26, 26, 79, 33, 27, 98, 66],
|
|
||||||
[88, 36, 68, 87, 57, 62, 20, 72, 3, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, 69],
|
|
||||||
[4, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36],
|
|
||||||
[20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 4, 36, 16],
|
|
||||||
[20, 73, 35, 29, 78, 31, 90, 1, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 5, 54],
|
|
||||||
[1, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 1, 89, 19, 67, 48]]
|
|
||||||
|
|
||||||
|
|
||||||
def Problem11():
|
|
||||||
#Setup the variables
|
|
||||||
greatestNumbers = [0, 0, 0, 0] #Holds the numbers that give the greatest product
|
|
||||||
currentNumbers = [0, 0, 0, 0] #Holds the numbers that you are currently working with
|
|
||||||
row = 0 #Holds the row in the grid that you are currently working on
|
|
||||||
col = 0 #Holds the column in the grid that you are currently working on
|
|
||||||
|
|
||||||
#Loop through every location in the grid
|
|
||||||
while(row < len(__grid)): #This loops through every row
|
|
||||||
col = 0 #Reset the column variable
|
|
||||||
while(col < len(__grid[row])): #This loops through every column
|
|
||||||
#Setup variables for knowing what direction you can move
|
|
||||||
moveLeft = False
|
|
||||||
moveRight = False
|
|
||||||
moveDown = False
|
|
||||||
|
|
||||||
#Check which directions you will be able to move
|
|
||||||
if((col - 3) >= 0):
|
|
||||||
moveLeft = True
|
|
||||||
if((col + 3) < len(__grid[row])):
|
|
||||||
moveRight = True
|
|
||||||
if((row + 3) < 20):
|
|
||||||
moveDown = True
|
|
||||||
|
|
||||||
#With these movements check for the greatest product of 4 adjacent numebrs
|
|
||||||
#Move Right
|
|
||||||
if moveRight:
|
|
||||||
currentNumbers[0] = __grid[row][col]
|
|
||||||
currentNumbers[1] = __grid[row][col + 1]
|
|
||||||
currentNumbers[2] = __grid[row][col + 2]
|
|
||||||
currentNumbers[3] = __grid[row][col + 3]
|
|
||||||
|
|
||||||
if(prod(currentNumbers) > prod(greatestNumbers)):
|
|
||||||
greatestNumbers = currentNumbers.copy()
|
|
||||||
|
|
||||||
#Move Down
|
|
||||||
if moveDown:
|
|
||||||
currentNumbers[0] = __grid[row][col]
|
|
||||||
currentNumbers[1] = __grid[row + 1][col]
|
|
||||||
currentNumbers[2] = __grid[row + 2][col]
|
|
||||||
currentNumbers[3] = __grid[row + 3][col]
|
|
||||||
|
|
||||||
if(prod(currentNumbers) > prod(greatestNumbers)):
|
|
||||||
greatestNumbers = currentNumbers.copy()
|
|
||||||
|
|
||||||
#Move Down & Left
|
|
||||||
if(moveDown and moveLeft):
|
|
||||||
currentNumbers[0] = __grid[row][col]
|
|
||||||
currentNumbers[1] = __grid[row + 1][col - 1]
|
|
||||||
currentNumbers[2] = __grid[row + 2][col - 2]
|
|
||||||
currentNumbers[3] = __grid[row + 3][col - 3]
|
|
||||||
|
|
||||||
if(prod(currentNumbers) > prod(greatestNumbers)):
|
|
||||||
greatestNumbers = currentNumbers.copy()
|
|
||||||
|
|
||||||
#Move Down & Right
|
|
||||||
if(moveDown and moveRight):
|
|
||||||
currentNumbers[0] = __grid[row][col]
|
|
||||||
currentNumbers[1] = __grid[row + 1][col + 1]
|
|
||||||
currentNumbers[2] = __grid[row + 2][col + 2]
|
|
||||||
currentNumbers[3] = __grid[row + 3][col + 3]
|
|
||||||
|
|
||||||
if(prod(currentNumbers) > prod(greatestNumbers)):
|
|
||||||
greatestNumbers = currentNumbers.copy()
|
|
||||||
|
|
||||||
#Move to the next column
|
|
||||||
col += 1
|
|
||||||
#Move to the next row
|
|
||||||
row += 1
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The greatest product of 3 numbers in a line is " + str(prod(greatestNumbers)))
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch() #Determines the algorithm's run time
|
|
||||||
timer.start() #Start the timer
|
|
||||||
Problem11() #Call the function that answers the question
|
|
||||||
timer.stop() #Stop the timer
|
|
||||||
#Print the results of the timer
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
"""Results:
|
|
||||||
The greatest product of 3 numbers in a line is 70600674
|
|
||||||
It took 1.162 milliseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
66
Problem12.py
66
Problem12.py
@@ -1,66 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem12.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 01-31-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#What is the value of the first triangle number to have over five hundred divisors?
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
from Algorithms import getDivisors
|
|
||||||
|
|
||||||
__goalDivisors = 500 #The number of divisors a number needs to reach
|
|
||||||
|
|
||||||
|
|
||||||
def Problem12():
|
|
||||||
#Setup the variables
|
|
||||||
triangularNumber = 1 #Holds the triangular numbers
|
|
||||||
nextNumber = 2 #The next number to be added to the triangular number
|
|
||||||
foundNumber = False #A flag for when the triangular number has over __goalDivisors divisors
|
|
||||||
|
|
||||||
#Start at the first triangular number and loop around, moving to the next, until you find one with the appropriate number of divisors
|
|
||||||
while((not foundNumber) and (triangularNumber > 0)): #Make sure you haven't caused an overflow and made trianularNumber negative
|
|
||||||
#See how many divisors this triangular number has
|
|
||||||
divisors = getDivisors(triangularNumber)
|
|
||||||
#If it did have enough raise a flag to stop the loop
|
|
||||||
if(len(divisors) > __goalDivisors):
|
|
||||||
foundNumber = True
|
|
||||||
else:
|
|
||||||
triangularNumber += nextNumber #Add the next number to continue the triangular sequence
|
|
||||||
nextNumber += 1 #Advance to the next number in the triangular sequence
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
if(triangularNumber <= 0):
|
|
||||||
print("There was an error. Could not find a triangular number with " + str(__goalDivisors) + " divisors before overflow")
|
|
||||||
else:
|
|
||||||
print("The first triangular number with more than " + str(__goalDivisors) + " divisors is " + str(triangularNumber))
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch() #Determines the algorithm's run time
|
|
||||||
timer.start() #Start the timer
|
|
||||||
Problem12() #Call the function that answers the question
|
|
||||||
timer.stop() #Stop the timer
|
|
||||||
#Print the results of the timer
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
"""Results:
|
|
||||||
The first triangular number with more than 500 divisors is 76576500
|
|
||||||
It took 2.898 seconds to run this algorithm
|
|
||||||
"""
|
|
||||||
253
Problem13.py
253
Problem13.py
@@ -1,253 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem13.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 01-31-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#Work out the first ten digits of the sum of the following one-hundred 50-digit numbers
|
|
||||||
"""
|
|
||||||
37107287533902102798797998220837590246510135740250
|
|
||||||
46376937677490009712648124896970078050417018260538
|
|
||||||
74324986199524741059474233309513058123726617309629
|
|
||||||
91942213363574161572522430563301811072406154908250
|
|
||||||
23067588207539346171171980310421047513778063246676
|
|
||||||
89261670696623633820136378418383684178734361726757
|
|
||||||
28112879812849979408065481931592621691275889832738
|
|
||||||
44274228917432520321923589422876796487670272189318
|
|
||||||
47451445736001306439091167216856844588711603153276
|
|
||||||
70386486105843025439939619828917593665686757934951
|
|
||||||
62176457141856560629502157223196586755079324193331
|
|
||||||
64906352462741904929101432445813822663347944758178
|
|
||||||
92575867718337217661963751590579239728245598838407
|
|
||||||
58203565325359399008402633568948830189458628227828
|
|
||||||
80181199384826282014278194139940567587151170094390
|
|
||||||
35398664372827112653829987240784473053190104293586
|
|
||||||
86515506006295864861532075273371959191420517255829
|
|
||||||
71693888707715466499115593487603532921714970056938
|
|
||||||
54370070576826684624621495650076471787294438377604
|
|
||||||
53282654108756828443191190634694037855217779295145
|
|
||||||
36123272525000296071075082563815656710885258350721
|
|
||||||
45876576172410976447339110607218265236877223636045
|
|
||||||
17423706905851860660448207621209813287860733969412
|
|
||||||
81142660418086830619328460811191061556940512689692
|
|
||||||
51934325451728388641918047049293215058642563049483
|
|
||||||
62467221648435076201727918039944693004732956340691
|
|
||||||
15732444386908125794514089057706229429197107928209
|
|
||||||
55037687525678773091862540744969844508330393682126
|
|
||||||
18336384825330154686196124348767681297534375946515
|
|
||||||
80386287592878490201521685554828717201219257766954
|
|
||||||
78182833757993103614740356856449095527097864797581
|
|
||||||
16726320100436897842553539920931837441497806860984
|
|
||||||
48403098129077791799088218795327364475675590848030
|
|
||||||
87086987551392711854517078544161852424320693150332
|
|
||||||
59959406895756536782107074926966537676326235447210
|
|
||||||
69793950679652694742597709739166693763042633987085
|
|
||||||
41052684708299085211399427365734116182760315001271
|
|
||||||
65378607361501080857009149939512557028198746004375
|
|
||||||
35829035317434717326932123578154982629742552737307
|
|
||||||
94953759765105305946966067683156574377167401875275
|
|
||||||
88902802571733229619176668713819931811048770190271
|
|
||||||
25267680276078003013678680992525463401061632866526
|
|
||||||
36270218540497705585629946580636237993140746255962
|
|
||||||
24074486908231174977792365466257246923322810917141
|
|
||||||
91430288197103288597806669760892938638285025333403
|
|
||||||
34413065578016127815921815005561868836468420090470
|
|
||||||
23053081172816430487623791969842487255036638784583
|
|
||||||
11487696932154902810424020138335124462181441773470
|
|
||||||
63783299490636259666498587618221225225512486764533
|
|
||||||
67720186971698544312419572409913959008952310058822
|
|
||||||
95548255300263520781532296796249481641953868218774
|
|
||||||
76085327132285723110424803456124867697064507995236
|
|
||||||
37774242535411291684276865538926205024910326572967
|
|
||||||
23701913275725675285653248258265463092207058596522
|
|
||||||
29798860272258331913126375147341994889534765745501
|
|
||||||
18495701454879288984856827726077713721403798879715
|
|
||||||
38298203783031473527721580348144513491373226651381
|
|
||||||
34829543829199918180278916522431027392251122869539
|
|
||||||
40957953066405232632538044100059654939159879593635
|
|
||||||
29746152185502371307642255121183693803580388584903
|
|
||||||
41698116222072977186158236678424689157993532961922
|
|
||||||
62467957194401269043877107275048102390895523597457
|
|
||||||
23189706772547915061505504953922979530901129967519
|
|
||||||
86188088225875314529584099251203829009407770775672
|
|
||||||
11306739708304724483816533873502340845647058077308
|
|
||||||
82959174767140363198008187129011875491310547126581
|
|
||||||
97623331044818386269515456334926366572897563400500
|
|
||||||
42846280183517070527831839425882145521227251250327
|
|
||||||
55121603546981200581762165212827652751691296897789
|
|
||||||
32238195734329339946437501907836945765883352399886
|
|
||||||
75506164965184775180738168837861091527357929701337
|
|
||||||
62177842752192623401942399639168044983993173312731
|
|
||||||
32924185707147349566916674687634660915035914677504
|
|
||||||
99518671430235219628894890102423325116913619626622
|
|
||||||
73267460800591547471830798392868535206946944540724
|
|
||||||
76841822524674417161514036427982273348055556214818
|
|
||||||
97142617910342598647204516893989422179826088076852
|
|
||||||
87783646182799346313767754307809363333018982642090
|
|
||||||
10848802521674670883215120185883543223812876952786
|
|
||||||
71329612474782464538636993009049310363619763878039
|
|
||||||
62184073572399794223406235393808339651327408011116
|
|
||||||
66627891981488087797941876876144230030984490851411
|
|
||||||
60661826293682836764744779239180335110989069790714
|
|
||||||
85786944089552990653640447425576083659976645795096
|
|
||||||
66024396409905389607120198219976047599490197230297
|
|
||||||
64913982680032973156037120041377903785566085089252
|
|
||||||
16730939319872750275468906903707539413042652315011
|
|
||||||
94809377245048795150954100921645863754710598436791
|
|
||||||
78639167021187492431995700641917969777599028300699
|
|
||||||
15368713711936614952811305876380278410754449733078
|
|
||||||
40789923115535562561142322423255033685442488917353
|
|
||||||
44889911501440648020369068063960672322193204149535
|
|
||||||
41503128880339536053299340368006977710650566631954
|
|
||||||
81234880673210146739058568557934581403627822703280
|
|
||||||
82616570773948327592232845941706525094512325230608
|
|
||||||
22918802058777319719839450180888072429661980811197
|
|
||||||
77158542502016545090413245809786882778948721859617
|
|
||||||
72107838435069186155435662884062257473692284509516
|
|
||||||
20849603980134001723930671666823555245252804609722
|
|
||||||
53503534226472524250874054075591789781264330331690
|
|
||||||
"""
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
|
|
||||||
#The numbers that need to be summed
|
|
||||||
__numbers = [37107287533902102798797998220837590246510135740250,
|
|
||||||
46376937677490009712648124896970078050417018260538,
|
|
||||||
74324986199524741059474233309513058123726617309629,
|
|
||||||
91942213363574161572522430563301811072406154908250,
|
|
||||||
23067588207539346171171980310421047513778063246676,
|
|
||||||
89261670696623633820136378418383684178734361726757,
|
|
||||||
28112879812849979408065481931592621691275889832738,
|
|
||||||
44274228917432520321923589422876796487670272189318,
|
|
||||||
47451445736001306439091167216856844588711603153276,
|
|
||||||
70386486105843025439939619828917593665686757934951,
|
|
||||||
62176457141856560629502157223196586755079324193331,
|
|
||||||
64906352462741904929101432445813822663347944758178,
|
|
||||||
92575867718337217661963751590579239728245598838407,
|
|
||||||
58203565325359399008402633568948830189458628227828,
|
|
||||||
80181199384826282014278194139940567587151170094390,
|
|
||||||
35398664372827112653829987240784473053190104293586,
|
|
||||||
86515506006295864861532075273371959191420517255829,
|
|
||||||
71693888707715466499115593487603532921714970056938,
|
|
||||||
54370070576826684624621495650076471787294438377604,
|
|
||||||
53282654108756828443191190634694037855217779295145,
|
|
||||||
36123272525000296071075082563815656710885258350721,
|
|
||||||
45876576172410976447339110607218265236877223636045,
|
|
||||||
17423706905851860660448207621209813287860733969412,
|
|
||||||
81142660418086830619328460811191061556940512689692,
|
|
||||||
51934325451728388641918047049293215058642563049483,
|
|
||||||
62467221648435076201727918039944693004732956340691,
|
|
||||||
15732444386908125794514089057706229429197107928209,
|
|
||||||
55037687525678773091862540744969844508330393682126,
|
|
||||||
18336384825330154686196124348767681297534375946515,
|
|
||||||
80386287592878490201521685554828717201219257766954,
|
|
||||||
78182833757993103614740356856449095527097864797581,
|
|
||||||
16726320100436897842553539920931837441497806860984,
|
|
||||||
48403098129077791799088218795327364475675590848030,
|
|
||||||
87086987551392711854517078544161852424320693150332,
|
|
||||||
59959406895756536782107074926966537676326235447210,
|
|
||||||
69793950679652694742597709739166693763042633987085,
|
|
||||||
41052684708299085211399427365734116182760315001271,
|
|
||||||
65378607361501080857009149939512557028198746004375,
|
|
||||||
35829035317434717326932123578154982629742552737307,
|
|
||||||
94953759765105305946966067683156574377167401875275,
|
|
||||||
88902802571733229619176668713819931811048770190271,
|
|
||||||
25267680276078003013678680992525463401061632866526,
|
|
||||||
36270218540497705585629946580636237993140746255962,
|
|
||||||
24074486908231174977792365466257246923322810917141,
|
|
||||||
91430288197103288597806669760892938638285025333403,
|
|
||||||
34413065578016127815921815005561868836468420090470,
|
|
||||||
23053081172816430487623791969842487255036638784583,
|
|
||||||
11487696932154902810424020138335124462181441773470,
|
|
||||||
63783299490636259666498587618221225225512486764533,
|
|
||||||
67720186971698544312419572409913959008952310058822,
|
|
||||||
95548255300263520781532296796249481641953868218774,
|
|
||||||
76085327132285723110424803456124867697064507995236,
|
|
||||||
37774242535411291684276865538926205024910326572967,
|
|
||||||
23701913275725675285653248258265463092207058596522,
|
|
||||||
29798860272258331913126375147341994889534765745501,
|
|
||||||
18495701454879288984856827726077713721403798879715,
|
|
||||||
38298203783031473527721580348144513491373226651381,
|
|
||||||
34829543829199918180278916522431027392251122869539,
|
|
||||||
40957953066405232632538044100059654939159879593635,
|
|
||||||
29746152185502371307642255121183693803580388584903,
|
|
||||||
41698116222072977186158236678424689157993532961922,
|
|
||||||
62467957194401269043877107275048102390895523597457,
|
|
||||||
23189706772547915061505504953922979530901129967519,
|
|
||||||
86188088225875314529584099251203829009407770775672,
|
|
||||||
11306739708304724483816533873502340845647058077308,
|
|
||||||
82959174767140363198008187129011875491310547126581,
|
|
||||||
97623331044818386269515456334926366572897563400500,
|
|
||||||
42846280183517070527831839425882145521227251250327,
|
|
||||||
55121603546981200581762165212827652751691296897789,
|
|
||||||
32238195734329339946437501907836945765883352399886,
|
|
||||||
75506164965184775180738168837861091527357929701337,
|
|
||||||
62177842752192623401942399639168044983993173312731,
|
|
||||||
32924185707147349566916674687634660915035914677504,
|
|
||||||
99518671430235219628894890102423325116913619626622,
|
|
||||||
73267460800591547471830798392868535206946944540724,
|
|
||||||
76841822524674417161514036427982273348055556214818,
|
|
||||||
97142617910342598647204516893989422179826088076852,
|
|
||||||
87783646182799346313767754307809363333018982642090,
|
|
||||||
10848802521674670883215120185883543223812876952786,
|
|
||||||
71329612474782464538636993009049310363619763878039,
|
|
||||||
62184073572399794223406235393808339651327408011116,
|
|
||||||
66627891981488087797941876876144230030984490851411,
|
|
||||||
60661826293682836764744779239180335110989069790714,
|
|
||||||
85786944089552990653640447425576083659976645795096,
|
|
||||||
66024396409905389607120198219976047599490197230297,
|
|
||||||
64913982680032973156037120041377903785566085089252,
|
|
||||||
16730939319872750275468906903707539413042652315011,
|
|
||||||
94809377245048795150954100921645863754710598436791,
|
|
||||||
78639167021187492431995700641917969777599028300699,
|
|
||||||
15368713711936614952811305876380278410754449733078,
|
|
||||||
40789923115535562561142322423255033685442488917353,
|
|
||||||
44889911501440648020369068063960672322193204149535,
|
|
||||||
41503128880339536053299340368006977710650566631954,
|
|
||||||
81234880673210146739058568557934581403627822703280,
|
|
||||||
82616570773948327592232845941706525094512325230608,
|
|
||||||
22918802058777319719839450180888072429661980811197,
|
|
||||||
77158542502016545090413245809786882778948721859617,
|
|
||||||
72107838435069186155435662884062257473692284509516,
|
|
||||||
20849603980134001723930671666823555245252804609722,
|
|
||||||
53503534226472524250874054075591789781264330331690]
|
|
||||||
|
|
||||||
|
|
||||||
def Problem13():
|
|
||||||
#Get the sum of all of the numbers in the list
|
|
||||||
sumOfNums = sum(__numbers)
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The sum of all " + str(len(__numbers)) + " numbers is " + str(sumOfNums))
|
|
||||||
print("The first 10 digits are: " + str(sumOfNums)[0:10])
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch() #Determines the algorithm's run time
|
|
||||||
timer.start() #Start the timer
|
|
||||||
Problem13() #Call the function that answers the question
|
|
||||||
timer.stop() #Stop the timer
|
|
||||||
#Print the results of the timer
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
"""Results:
|
|
||||||
The sum of all 100 numbers is 5537376230390876637302048746832985971773659831892672
|
|
||||||
The first 10 digits are: 5537376230
|
|
||||||
It took 23.015 microseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
80
Problem14.py
80
Problem14.py
@@ -1,80 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem14.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 01-31-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
"""
|
|
||||||
The following iterative sequence is defined for the set of positive integers:
|
|
||||||
n → n/2 (n is even)
|
|
||||||
n → 3n + 1 (n is odd)
|
|
||||||
Which starting number, under one million, produces the longest chain?
|
|
||||||
"""
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
|
|
||||||
__topNum = 1000000 #The largest number that you will check against the chain
|
|
||||||
|
|
||||||
|
|
||||||
#This function returns a list of numbers created by the chain
|
|
||||||
def getChain(startNum: int) -> list:
|
|
||||||
#Put the starting number in the list
|
|
||||||
chain = [startNum]
|
|
||||||
|
|
||||||
#Starting with the current number perform the correct opperations on the numbers until that number reaches 1
|
|
||||||
while(startNum > 1):
|
|
||||||
#Determine if the number is odd or even and perform the correct operation and add the new number to the list
|
|
||||||
if((startNum % 2) == 0):
|
|
||||||
startNum /= 2
|
|
||||||
else:
|
|
||||||
startNum = (3 * startNum) + 1
|
|
||||||
#Add the new number to the chain
|
|
||||||
chain.append(startNum)
|
|
||||||
|
|
||||||
#Return the list
|
|
||||||
return chain
|
|
||||||
|
|
||||||
def Problem14():
|
|
||||||
#Setup your variables
|
|
||||||
largestChain = [] #Holds the longest chain of numbers
|
|
||||||
|
|
||||||
#Start at 1 and run up to 1000000, checking how long the chain is when started with each number
|
|
||||||
for startingNumber in range(1, __topNum):
|
|
||||||
currentChain = getChain(startingNumber) #Get the chain
|
|
||||||
#If the new chain is longer than the current longest chain replace it
|
|
||||||
if(len(currentChain) > len(largestChain)):
|
|
||||||
largestChain = currentChain.copy()
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The longest chain with a starting number < " + str(__topNum) + " is " + str(largestChain[0]) + " with a length of " + str(len(largestChain)))
|
|
||||||
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch() #Determines the algorithm's run time
|
|
||||||
timer.start() #Start the timer
|
|
||||||
Problem14() #Call the function that answers the question
|
|
||||||
timer.stop() #Stop the timer
|
|
||||||
#Print the results of the timer
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
"""Results:
|
|
||||||
The longest chain with a starting number < 1000000 is 837799 with a length of 525
|
|
||||||
It took 28.893 seconds to run this algorithm
|
|
||||||
"""
|
|
||||||
66
Problem15.py
66
Problem15.py
@@ -1,66 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem15.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 01-31-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#How many routes from the top left corner to the bottom right corner are there through a 20×20 grid if you can only move right and down?
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
#There must be a better way than this. This is untested. I let it run for about 14 hours and it still hadn't spit an answer out for me
|
|
||||||
#But it is programed exactly as I programmed the C++ solution, so the eventual answer should be correct
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
|
|
||||||
__gridWidth = 20 #The height of the grid
|
|
||||||
__gridHeight = 20 #The width of the grid
|
|
||||||
|
|
||||||
|
|
||||||
def movement(currentX: int, currentY: int) -> int:
|
|
||||||
#Return 1 if you are at the finish location
|
|
||||||
if((currentX == __gridWidth) and (currentY == __gridHeight)):
|
|
||||||
return 1
|
|
||||||
|
|
||||||
numberMoves = 0
|
|
||||||
#Otherwise move one right if you can and recurse
|
|
||||||
if(currentX < __gridWidth):
|
|
||||||
numberMoves = movement(currentX + 1, currentY)
|
|
||||||
|
|
||||||
#Then move one down and recurse
|
|
||||||
if(currentY < __gridHeight):
|
|
||||||
numberMoves += movement(currentX, currentY + 1)
|
|
||||||
|
|
||||||
return numberMoves
|
|
||||||
|
|
||||||
def Problem15():
|
|
||||||
#Start the recursion at the right location and catch what is returned
|
|
||||||
numberMoves = movement(0, 0)
|
|
||||||
#Print the results
|
|
||||||
print("The number of paths from 1 corner of a " + str(__gridWidth) + " x " + str(__gridHeight) + " grid to the opposite corner is " + str(numberMoves))
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch() #Determines the algorithm's run time
|
|
||||||
timer.start() #Start the timer
|
|
||||||
Problem15() #Call the function that answers the question
|
|
||||||
timer.stop() #Stop the timer
|
|
||||||
#Print the results of the timer
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
"""Results:
|
|
||||||
|
|
||||||
"""
|
|
||||||
60
Problem16.py
60
Problem16.py
@@ -1,60 +0,0 @@
|
|||||||
#Project Euler/Python/Problem16.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 02-03-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#What is the sum of the digits of the number 2^1000?
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
|
|
||||||
|
|
||||||
def Problem16():
|
|
||||||
#Setup the variables
|
|
||||||
sumOfNum = 0 #Holds the sum of the numbers
|
|
||||||
#Get the number
|
|
||||||
num = 2 ** 1000
|
|
||||||
|
|
||||||
#Change the number to a string
|
|
||||||
stringOfNum = str(num)
|
|
||||||
|
|
||||||
#Step through the string one element at a time
|
|
||||||
for cnt in range(0, len(stringOfNum)):
|
|
||||||
#Change the character to an int and add it to the sum
|
|
||||||
sumOfNum += int(stringOfNum[cnt])
|
|
||||||
|
|
||||||
#Print the result
|
|
||||||
print("2^1000 = " + stringOfNum)
|
|
||||||
print("The sum of the digits is: " + str(sumOfNum))
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch() #Determines the algorithm's run time
|
|
||||||
timer.start() #Start the timer
|
|
||||||
Problem16() #Call the function that answers the question
|
|
||||||
timer.stop() #Stop the timer
|
|
||||||
#Print the results of the timer
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
|
|
||||||
"""Results:
|
|
||||||
2^1000 = 10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376
|
|
||||||
The sum of the digits is: 1366
|
|
||||||
It took 86.206 microseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
173
Problem17.py
173
Problem17.py
@@ -1,173 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem17.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 02-04-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used?
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
import math
|
|
||||||
|
|
||||||
__startNum = 1
|
|
||||||
__stopNum = 1000
|
|
||||||
|
|
||||||
|
|
||||||
#This function only works for numbers -1,000,000 < num < 1,000,000
|
|
||||||
def getStringFromNum(number: int) -> str:
|
|
||||||
numberString = ""
|
|
||||||
#Starting with the largest digit create a string based on the number passed in
|
|
||||||
#Check for negative
|
|
||||||
if(number < 0):
|
|
||||||
numberString += "negative "
|
|
||||||
|
|
||||||
#Check if the number is zero
|
|
||||||
if(number == 0):
|
|
||||||
numberString += "zero"
|
|
||||||
|
|
||||||
#Start with the thousands place
|
|
||||||
if((number / 1000) >= 1):
|
|
||||||
numberString += getStringFromNum(math.floor(number / 1000))
|
|
||||||
numberString += " thousand"
|
|
||||||
number -= (math.floor(number / 1000) * 1000)
|
|
||||||
|
|
||||||
#Check for hundreds place
|
|
||||||
if((number / 100) >= 1):
|
|
||||||
numberString += getStringFromNum(math.floor(number / 100))
|
|
||||||
numberString += " hundred"
|
|
||||||
number -= (math.floor(number / 100) * 100)
|
|
||||||
|
|
||||||
#Insert an and if there is need
|
|
||||||
if((numberString != "") and (number > 0)):
|
|
||||||
numberString += " and "
|
|
||||||
|
|
||||||
#Check for tens place
|
|
||||||
if((number / 10) >= 2):
|
|
||||||
#For the tens you need to do something special
|
|
||||||
tensPlace = math.floor(number / 10)
|
|
||||||
if(tensPlace == 9):
|
|
||||||
numberString += "ninety"
|
|
||||||
elif(tensPlace == 8):
|
|
||||||
numberString += "eighty"
|
|
||||||
elif(tensPlace == 7):
|
|
||||||
numberString += "seventy"
|
|
||||||
elif(tensPlace == 6):
|
|
||||||
numberString += "sixty"
|
|
||||||
elif(tensPlace == 5):
|
|
||||||
numberString += "fifty"
|
|
||||||
elif(tensPlace == 4):
|
|
||||||
numberString += "forty"
|
|
||||||
elif(tensPlace == 3):
|
|
||||||
numberString += "thirty"
|
|
||||||
elif(tensPlace == 2):
|
|
||||||
numberString += "twenty"
|
|
||||||
number -= (tensPlace * 10)
|
|
||||||
#If there is something left in the number you will need a space to separate it
|
|
||||||
if(number > 0):
|
|
||||||
numberString += ' '
|
|
||||||
#Check for teens
|
|
||||||
elif((number / 10) >= 1):
|
|
||||||
onesPlace = (number % 10)
|
|
||||||
if(onesPlace == 9):
|
|
||||||
numberString += "nineteen"
|
|
||||||
elif(onesPlace == 8):
|
|
||||||
numberString += "eighteen"
|
|
||||||
elif(onesPlace == 7):
|
|
||||||
numberString += "seventeen"
|
|
||||||
elif(onesPlace == 6):
|
|
||||||
numberString += "sixteen"
|
|
||||||
elif(onesPlace == 5):
|
|
||||||
numberString += "fifteen"
|
|
||||||
elif(onesPlace == 4):
|
|
||||||
numberString += "fourteen"
|
|
||||||
elif(onesPlace == 3):
|
|
||||||
numberString += "thirteen"
|
|
||||||
elif(onesPlace == 2):
|
|
||||||
numberString += "twelve"
|
|
||||||
elif(onesPlace == 1):
|
|
||||||
numberString += "eleven"
|
|
||||||
elif(onesPlace == 0):
|
|
||||||
numberString += "ten"
|
|
||||||
#If this if was hit number was used up
|
|
||||||
number = 0
|
|
||||||
|
|
||||||
#Check for ones place
|
|
||||||
if(number >= 1):
|
|
||||||
if(number == 9):
|
|
||||||
numberString += "nine"
|
|
||||||
elif(number == 8):
|
|
||||||
numberString += "eight"
|
|
||||||
elif(number == 7):
|
|
||||||
numberString += "seven"
|
|
||||||
elif(number == 6):
|
|
||||||
numberString += "six"
|
|
||||||
elif(number == 5):
|
|
||||||
numberString += "five"
|
|
||||||
elif(number == 4):
|
|
||||||
numberString += "four"
|
|
||||||
elif(number == 3):
|
|
||||||
numberString += "three"
|
|
||||||
elif(number == 2):
|
|
||||||
numberString += "two"
|
|
||||||
elif(number == 1):
|
|
||||||
numberString += "one"
|
|
||||||
#If this if was hit number was used up
|
|
||||||
number = 0
|
|
||||||
|
|
||||||
#Return the string
|
|
||||||
return numberString
|
|
||||||
|
|
||||||
|
|
||||||
def getNumberChars(number: str) -> int:
|
|
||||||
sumOfLetters = 0
|
|
||||||
#Start at location 0 and count the number of letters, ignoring punctuation and whitespace
|
|
||||||
for location in range(0, len(number)):
|
|
||||||
tempString = number[location]
|
|
||||||
if(tempString.isalpha()):
|
|
||||||
sumOfLetters += 1
|
|
||||||
|
|
||||||
#Return the number
|
|
||||||
return sumOfLetters
|
|
||||||
|
|
||||||
|
|
||||||
def Problem17():
|
|
||||||
sumOfLetters = 0
|
|
||||||
#Start with 1 and increment
|
|
||||||
for num in range(__startNum, __stopNum + 1):
|
|
||||||
#Pass the number to a function that will create a string for the number
|
|
||||||
currentNumString = getStringFromNum(num)
|
|
||||||
#Pass the string to a function that will count the number of letters in a string, ignoring whitespace and punctuation and add the amount to the running tally
|
|
||||||
sumOfLetters += getNumberChars(currentNumString)
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The sum of all the letters in all the numbers " + str(__startNum) + '-' + str(__stopNum) + " is " + str(sumOfLetters))
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch() #Determines the algorithm's run time
|
|
||||||
timer.start() #Start the timer
|
|
||||||
Problem17() #Call the function that answers the question
|
|
||||||
timer.stop() #Stop the timer
|
|
||||||
#Print the results of the timer
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
"""Results:
|
|
||||||
The sum of all the letters in all the numbers 1-1000 is 21124
|
|
||||||
It took 4.107 milliseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
139
Problem18.py
139
Problem18.py
@@ -1,139 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem18.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 03-12-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#Find the maximum total from top to bottom
|
|
||||||
"""
|
|
||||||
75
|
|
||||||
95 64
|
|
||||||
17 47 82
|
|
||||||
18 35 87 10
|
|
||||||
20 04 82 47 65
|
|
||||||
19 01 23 75 03 34
|
|
||||||
88 02 77 73 07 63 67
|
|
||||||
99 65 04 28 06 16 70 92
|
|
||||||
41 41 26 56 83 40 80 70 33
|
|
||||||
41 48 72 33 47 32 37 16 94 29
|
|
||||||
53 71 44 65 25 43 91 52 97 51 14
|
|
||||||
70 11 33 28 77 73 17 78 39 68 17 57
|
|
||||||
91 71 52 38 17 14 91 43 58 50 27 29 48
|
|
||||||
63 66 04 68 89 53 67 30 73 16 69 87 40 31
|
|
||||||
04 62 98 27 23 09 70 98 73 93 38 53 60 04 23
|
|
||||||
"""
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
from collections import namedtuple
|
|
||||||
|
|
||||||
|
|
||||||
location = namedtuple("location", "xLocation yLocation total fromRight")
|
|
||||||
|
|
||||||
NUM_ROWS = 15
|
|
||||||
|
|
||||||
|
|
||||||
def invert(listNum):
|
|
||||||
for rowCnt in range(0, NUM_ROWS):
|
|
||||||
for colCnt in range(0, len(listNum[rowCnt])):
|
|
||||||
listNum[rowCnt][colCnt] = 100 - listNum[rowCnt][colCnt]
|
|
||||||
|
|
||||||
def removeIf(listNum: list, loc):
|
|
||||||
location = 0
|
|
||||||
while(location < len(listNum)):
|
|
||||||
if((listNum[location].xLocation == loc.xLocation) and (listNum[location].yLocation == loc.yLocation)):
|
|
||||||
del listNum[location]
|
|
||||||
else:
|
|
||||||
location += 1
|
|
||||||
|
|
||||||
def Problem18():
|
|
||||||
listNum = [[75],
|
|
||||||
[95, 64],
|
|
||||||
[17, 47, 82],
|
|
||||||
[18, 35, 87, 10],
|
|
||||||
[20, 4, 82, 47, 65],
|
|
||||||
[19, 1, 23, 75, 3, 34],
|
|
||||||
[88, 2, 77, 73, 7, 63, 67],
|
|
||||||
[99, 65, 4, 28, 6, 16, 70, 92],
|
|
||||||
[41, 41, 26, 56, 83, 40, 80, 70, 33],
|
|
||||||
[41, 48, 72, 33, 47, 32, 37, 16, 94, 29],
|
|
||||||
[53, 71, 44, 65, 25, 43, 91, 52, 97, 51, 14],
|
|
||||||
[70, 11, 33, 28, 77, 73, 17, 78, 39, 68, 17, 57],
|
|
||||||
[91, 71, 52, 38, 17, 14, 91, 43, 58, 50, 27, 29, 48],
|
|
||||||
[63, 66, 4, 68, 89, 53, 67, 30, 73, 16, 69, 87, 40, 31],
|
|
||||||
[ 4, 62, 98, 27, 23, 9, 70, 98, 73, 93, 38, 53, 60, 4, 23]]
|
|
||||||
|
|
||||||
#Invert the list so that each element = 100 - element
|
|
||||||
invert(listNum)
|
|
||||||
|
|
||||||
#Holds points we know are of the shortest route
|
|
||||||
foundPoints = []
|
|
||||||
#Add the tip of the pyramid because everything has to go through that
|
|
||||||
foundPoints.append(location(0, 0, listNum[0][0], True))
|
|
||||||
#Holds points that might be the shortest route
|
|
||||||
possiblePoints = []
|
|
||||||
#Add the second row as possible points because everything must pass through the second row
|
|
||||||
possiblePoints.append(location(0, 1, (listNum[0][0] + listNum[1][0]), True))
|
|
||||||
possiblePoints.append(location(1, 1, (listNum[0][0] + listNum[1][1]), False))
|
|
||||||
foundBottom = False
|
|
||||||
|
|
||||||
#Loop until you find the bottom
|
|
||||||
while(not foundBottom):
|
|
||||||
#Check which possible point gives us the lowest number. If more than one has the same number simply keep the first one
|
|
||||||
minLoc = possiblePoints[0]
|
|
||||||
for loc in possiblePoints:
|
|
||||||
if(loc.total < minLoc.total):
|
|
||||||
minLoc = loc
|
|
||||||
|
|
||||||
#Remove it from the list of possible points
|
|
||||||
removeIf(possiblePoints, minLoc)
|
|
||||||
|
|
||||||
foundPoints.append(minLoc)
|
|
||||||
|
|
||||||
#Add to the list of possible points from the point we just found and
|
|
||||||
#If you are at the bottom raise the flag to end the program
|
|
||||||
xLoc = minLoc.xLocation
|
|
||||||
yLoc = minLoc.yLocation + 1
|
|
||||||
if(yLoc >= NUM_ROWS):
|
|
||||||
foundBottom = True
|
|
||||||
else:
|
|
||||||
possiblePoints.append(location(xLoc, yLoc, minLoc.total + listNum[yLoc][xLoc], True))
|
|
||||||
xLoc += 1
|
|
||||||
possiblePoints.append(location(xLoc, yLoc, minLoc.total + listNum[yLoc][xLoc], False))
|
|
||||||
|
|
||||||
#Get the real total of the journey
|
|
||||||
actualTotal = ((100 * NUM_ROWS) - foundPoints[len(foundPoints) - 1].total)
|
|
||||||
|
|
||||||
#Invert the list so it can be read again
|
|
||||||
invert(listNum)
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The value of the longest path is " + str(actualTotal))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch()
|
|
||||||
timer.start()
|
|
||||||
Problem18()
|
|
||||||
timer.stop()
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
""" Results:
|
|
||||||
The value of the longest path is 1074
|
|
||||||
It took 654.691 microseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
162
Problem19.py
162
Problem19.py
@@ -1,162 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem19.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 03-13-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?
|
|
||||||
"""
|
|
||||||
You are given the following information, but you may prefer to do some research for yourself.
|
|
||||||
1 Jan 1900 was a Monday.
|
|
||||||
Thirty days has September,
|
|
||||||
April, June and November.
|
|
||||||
All the rest have thirty-one,
|
|
||||||
Saving February alone,
|
|
||||||
Which has twenty-eight, rain or shine.
|
|
||||||
And on leap years, twenty-nine.
|
|
||||||
A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400.
|
|
||||||
"""
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
|
|
||||||
|
|
||||||
class DAYS:
|
|
||||||
SUNDAY = 0
|
|
||||||
MONDAY = 1
|
|
||||||
TUESDAY = 2
|
|
||||||
WEDNESDAY = 3
|
|
||||||
THURSDAY = 4
|
|
||||||
FRIDAY = 5
|
|
||||||
SATURDAY = 6
|
|
||||||
NUMBER_OF_DAYS = 7
|
|
||||||
ERROR = 8
|
|
||||||
START_YEAR = 1901 #The year we start counting sundays
|
|
||||||
END_YEAR = 2000 #The year we stop counting sundays
|
|
||||||
|
|
||||||
#Return the day of the week that the date you pass into it is on
|
|
||||||
def getDay(month: int, day: int, year: int) -> DAYS:
|
|
||||||
#Make sure the numebrs are within propper bounds
|
|
||||||
if((month < 1) or (month > 12) or (day < 1) or (day > 31) or (year < 1)):
|
|
||||||
return DAYS.ERROR
|
|
||||||
|
|
||||||
numDays = 0 #The number of days between 01-01-0001 and the date given
|
|
||||||
currentYear = 1
|
|
||||||
currentMonth = 1
|
|
||||||
currentDay = DAYS.SATURDAY
|
|
||||||
day -= 1
|
|
||||||
|
|
||||||
#Add the correct number of days for every year
|
|
||||||
while(currentYear < year):
|
|
||||||
if(isLeapYear(currentYear)):
|
|
||||||
numDays += 366
|
|
||||||
else:
|
|
||||||
numDays += 365
|
|
||||||
currentYear += 1
|
|
||||||
#Add the correct number of days for eveyr month
|
|
||||||
while(currentMonth < month):
|
|
||||||
#February
|
|
||||||
if(currentMonth == 2):
|
|
||||||
if(isLeapYear(currentYear)):
|
|
||||||
numDays += 29
|
|
||||||
else:
|
|
||||||
numDays += 28
|
|
||||||
elif((currentMonth == 1) or (currentMonth == 3) or (currentMonth == 5) or (currentMonth == 7) or (currentMonth == 8) or (currentMonth == 10) or (currentMonth == 12)):
|
|
||||||
numDays += 31
|
|
||||||
#For 30 day months
|
|
||||||
else:
|
|
||||||
numDays += 30
|
|
||||||
currentMonth += 1
|
|
||||||
#Account for the weird year of 1752
|
|
||||||
if(year > 1752):
|
|
||||||
numDays -= 11
|
|
||||||
elif(year == 1752):
|
|
||||||
if(month > 9):
|
|
||||||
numDays -= 11
|
|
||||||
elif(month == 9):
|
|
||||||
if(day >= 14):
|
|
||||||
numDays -= 11
|
|
||||||
#Days 3-13 were skipped that year
|
|
||||||
elif((day > 2) and (day < 14)):
|
|
||||||
return DAYS.ERROR
|
|
||||||
#Add the correct number of days for every day
|
|
||||||
numDays += day
|
|
||||||
|
|
||||||
currentDay += numDays
|
|
||||||
currentDay = currentDay % DAYS.NUMBER_OF_DAYS
|
|
||||||
if(currentDay == DAYS.SUNDAY):
|
|
||||||
return DAYS.SUNDAY
|
|
||||||
elif(currentDay == DAYS.MONDAY):
|
|
||||||
return DAYS.MONDAY
|
|
||||||
elif(currentDay == DAYS.TUESDAY):
|
|
||||||
return DAYS.TUESDAY
|
|
||||||
elif(currentDay == DAYS.WEDNESDAY):
|
|
||||||
return DAYS.WEDNESDAY
|
|
||||||
elif(currentDay == DAYS.THURSDAY):
|
|
||||||
return DAYS.THURSDAY
|
|
||||||
elif(currentDay == DAYS.FRIDAY):
|
|
||||||
return DAYS.FRIDAY
|
|
||||||
elif(currentDay == DAYS.SATURDAY):
|
|
||||||
return DAYS.SATURDAY
|
|
||||||
else:
|
|
||||||
return DAYS.ERROR
|
|
||||||
|
|
||||||
#Returns true if the year passed to it is a leap year
|
|
||||||
def isLeapYear(year: int) -> bool:
|
|
||||||
if(year < 1):
|
|
||||||
return False
|
|
||||||
elif((year % 100) == 0):
|
|
||||||
#This rule only applies at and after 1800
|
|
||||||
if(year <= 1700):
|
|
||||||
return True
|
|
||||||
elif((year % 400) == 0):
|
|
||||||
return True
|
|
||||||
elif((year % 4) == 0):
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def Problem19():
|
|
||||||
totalSundays = 0 #Keep track of the number of sundays
|
|
||||||
|
|
||||||
#Run for all years from start to end
|
|
||||||
for year in range(START_YEAR, END_YEAR + 1):
|
|
||||||
#Run for all months in the year
|
|
||||||
for month in range(1, 13):
|
|
||||||
day = getDay(month, 1, year)
|
|
||||||
if(day == DAYS.ERROR):
|
|
||||||
print("There was an error with the day")
|
|
||||||
return
|
|
||||||
elif(day == DAYS.SUNDAY):
|
|
||||||
totalSundays += 1
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("There are " + str(totalSundays) + " Sundays that landed on the first of the month from " + str(START_YEAR) + " to " + str(END_YEAR))
|
|
||||||
|
|
||||||
|
|
||||||
#Run automatically if the script was called stand alone
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch()
|
|
||||||
timer.start()
|
|
||||||
Problem19()
|
|
||||||
timer.stop()
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
""" Results:
|
|
||||||
There are 171 Sundays that landed on the first of the month from 1901 to 2000
|
|
||||||
It took 724.930 milliseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
61
Problem2.py
61
Problem2.py
@@ -1,61 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem2.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 01-26-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#The sum of the even Fibonacci numbers less than 4,000,000
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
from Algorithms import getAllFib
|
|
||||||
|
|
||||||
__topNumber = 4000000
|
|
||||||
|
|
||||||
|
|
||||||
def Problem2():
|
|
||||||
#Setup your variables
|
|
||||||
fibSum = 0 #Holds the sum of the Fibonacci numbers
|
|
||||||
fibNums = [] #An array that holds the Fibonacci numbers
|
|
||||||
|
|
||||||
#Get all of the fibonacci numbers
|
|
||||||
fibNums = getAllFib(__topNumber - 1) #Send it - 1 because it is < __topNumber
|
|
||||||
|
|
||||||
#Determine if each number is odd or even
|
|
||||||
for num in fibNums:
|
|
||||||
#If it is even add it to the running sum
|
|
||||||
if((num % 2) == 0):
|
|
||||||
fibSum += num
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The sum of all even Fibonacci numbers less than " + str(__topNumber) + " is " + str(fibSum))
|
|
||||||
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
|
||||||
if __name__ == '__main__':
|
|
||||||
timer = Stopwatch() #Use to determine the algorithm's run time
|
|
||||||
timer.start() #Start the timer
|
|
||||||
Problem2() #Call the function that answers the question
|
|
||||||
timer.stop() #Stop the timer
|
|
||||||
#Print the results of the timer
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
"""Results:
|
|
||||||
The sum of all even Fibonacci numbers less than 4000000 is 4613732
|
|
||||||
It took 27.621 microseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
61
Problem20.py
61
Problem20.py
@@ -1,61 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem20.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 03-14-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#What is the sum of the digits of 100!
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
|
|
||||||
__TOP_NUM = 100 #The number that you are trying to find the factorial of
|
|
||||||
|
|
||||||
|
|
||||||
def Problem20():
|
|
||||||
num = 1 #Holds the number being calculated
|
|
||||||
sumOfNum = 0 #Holds the sum of the digits of num
|
|
||||||
|
|
||||||
#Run through every number from 1 to 100 and multiply it by the current num to get 100!
|
|
||||||
for cnt in range(1, __TOP_NUM + 1):
|
|
||||||
num *= cnt
|
|
||||||
|
|
||||||
#Get a string of the number because it is easier to pull appart the individual charaters for the sum
|
|
||||||
numString = str(num)
|
|
||||||
#Run through every character in the string, convert it back to an integer and add it to the running sum
|
|
||||||
for char in numString:
|
|
||||||
sumOfNum += int(char)
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("100! = " + numString)
|
|
||||||
print("The sum of the digits is: " + str(sumOfNum))
|
|
||||||
|
|
||||||
|
|
||||||
#This starts the correct function if called directly
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch()
|
|
||||||
timer.start()
|
|
||||||
Problem20()
|
|
||||||
timer.stop()
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
""" Results:
|
|
||||||
100! = 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
|
|
||||||
The sum of the digits is: 648
|
|
||||||
It took 99.670 microseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
85
Problem21.py
85
Problem21.py
@@ -1,85 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem21.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 03-18-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#Evaluate the sum of all the amicable numbers under 10000
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
import Algorithms
|
|
||||||
|
|
||||||
__limit = 10000 #The top number that will be evaluated
|
|
||||||
|
|
||||||
|
|
||||||
def Problem21():
|
|
||||||
#Setup the variables
|
|
||||||
divisorSum = [] #Holds the sum of the divisors of the subscript number
|
|
||||||
divisorSum.append(0) #Start with a 0 in the [0] location
|
|
||||||
|
|
||||||
#Generate the divisors of all the numbers < 10000, get their sum, and add it to the list
|
|
||||||
for cnt in range(1, __limit):
|
|
||||||
divisors = Algorithms.getDivisors(cnt) #Get all the divisors of a number
|
|
||||||
if(len(divisors) > 1):
|
|
||||||
divisors.pop() #Remove the last entry because it will be the number itself
|
|
||||||
divisorSum.append(int(sum(divisors)))
|
|
||||||
#Check every sum of divisors in the list for a matching sum
|
|
||||||
amicable = []
|
|
||||||
for cnt in range(1, len(divisorSum)):
|
|
||||||
currentSum = divisorSum[cnt]
|
|
||||||
#If the sum is greater than the number of divisors then it is impossible to be amicable. Skip the number and continue
|
|
||||||
if(currentSum >= len(divisorSum)):
|
|
||||||
continue
|
|
||||||
#We know that divisorSum[cnt] == currentSum, so if divisorSum[currentSum] == cnt we found an amicable number
|
|
||||||
if(divisorSum[currentSum] == cnt):
|
|
||||||
#A number can't be amicable with itself
|
|
||||||
if(currentSum == cnt):
|
|
||||||
continue
|
|
||||||
#Add the number to the amicable vector
|
|
||||||
amicable.append(cnt)
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("All amicable numbers less than 10000 are")
|
|
||||||
for num in amicable:
|
|
||||||
print(str(num))
|
|
||||||
print("The sum of all of these amicable numbers is " + str(sum(amicable)))
|
|
||||||
|
|
||||||
#Run the correct function if this script is called stand along
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch()
|
|
||||||
timer.start()
|
|
||||||
Problem21()
|
|
||||||
timer.stop()
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
""" Results:
|
|
||||||
All amicable numbers less than 10000 are
|
|
||||||
220
|
|
||||||
284
|
|
||||||
1184
|
|
||||||
1210
|
|
||||||
2620
|
|
||||||
2924
|
|
||||||
5020
|
|
||||||
5564
|
|
||||||
6232
|
|
||||||
6368
|
|
||||||
The sum of all of these amicable numbers is 31626
|
|
||||||
It took 59.496 milliseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
432
Problem22.py
432
Problem22.py
@@ -1,432 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem22.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 03-20-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#What is the total of all the name scores in the file?
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
import Algorithms
|
|
||||||
|
|
||||||
|
|
||||||
__NAMES = ["MARY","PATRICIA","LINDA","BARBARA","ELIZABETH","JENNIFER","MARIA","SUSAN","MARGARET","DOROTHY","LISA","NANCY","KAREN",
|
|
||||||
"BETTY","HELEN","SANDRA","DONNA","CAROL","RUTH","SHARON","MICHELLE","LAURA","SARAH","KIMBERLY","DEBORAH","JESSICA","SHIRLEY",
|
|
||||||
"CYNTHIA","ANGELA","MELISSA","BRENDA","AMY","ANNA","REBECCA","VIRGINIA","KATHLEEN","PAMELA","MARTHA","DEBRA","AMANDA","STEPHANIE",
|
|
||||||
"CAROLYN","CHRISTINE","MARIE","JANET","CATHERINE","FRANCES","ANN","JOYCE","DIANE","ALICE","JULIE","HEATHER","TERESA","DORIS",
|
|
||||||
"GLORIA","EVELYN","JEAN","CHERYL","MILDRED","KATHERINE","JOAN","ASHLEY","JUDITH","ROSE","JANICE","KELLY","NICOLE","JUDY",
|
|
||||||
"CHRISTINA","KATHY","THERESA","BEVERLY","DENISE","TAMMY","IRENE","JANE","LORI","RACHEL","MARILYN","ANDREA","KATHRYN","LOUISE",
|
|
||||||
"SARA","ANNE","JACQUELINE","WANDA","BONNIE","JULIA","RUBY","LOIS","TINA","PHYLLIS","NORMA","PAULA","DIANA","ANNIE","LILLIAN",
|
|
||||||
"EMILY","ROBIN","PEGGY","CRYSTAL","GLADYS","RITA","DAWN","CONNIE","FLORENCE","TRACY","EDNA","TIFFANY","CARMEN","ROSA","CINDY",
|
|
||||||
"GRACE","WENDY","VICTORIA","EDITH","KIM","SHERRY","SYLVIA","JOSEPHINE","THELMA","SHANNON","SHEILA","ETHEL","ELLEN","ELAINE",
|
|
||||||
"MARJORIE","CARRIE","CHARLOTTE","MONICA","ESTHER","PAULINE","EMMA","JUANITA","ANITA","RHONDA","HAZEL","AMBER","EVA","DEBBIE",
|
|
||||||
"APRIL","LESLIE","CLARA","LUCILLE","JAMIE","JOANNE","ELEANOR","VALERIE","DANIELLE","MEGAN","ALICIA","SUZANNE","MICHELE","GAIL",
|
|
||||||
"BERTHA","DARLENE","VERONICA","JILL","ERIN","GERALDINE","LAUREN","CATHY","JOANN","LORRAINE","LYNN","SALLY","REGINA","ERICA",
|
|
||||||
"BEATRICE","DOLORES","BERNICE","AUDREY","YVONNE","ANNETTE","JUNE","SAMANTHA","MARION","DANA","STACY","ANA","RENEE","IDA","VIVIAN",
|
|
||||||
"ROBERTA","HOLLY","BRITTANY","MELANIE","LORETTA","YOLANDA","JEANETTE","LAURIE","KATIE","KRISTEN","VANESSA","ALMA","SUE","ELSIE",
|
|
||||||
"BETH","JEANNE","VICKI","CARLA","TARA","ROSEMARY","EILEEN","TERRI","GERTRUDE","LUCY","TONYA","ELLA","STACEY","WILMA","GINA",
|
|
||||||
"KRISTIN","JESSIE","NATALIE","AGNES","VERA","WILLIE","CHARLENE","BESSIE","DELORES","MELINDA","PEARL","ARLENE","MAUREEN","COLLEEN",
|
|
||||||
"ALLISON","TAMARA","JOY","GEORGIA","CONSTANCE","LILLIE","CLAUDIA","JACKIE","MARCIA","TANYA","NELLIE","MINNIE","MARLENE","HEIDI",
|
|
||||||
"GLENDA","LYDIA","VIOLA","COURTNEY","MARIAN","STELLA","CAROLINE","DORA","JO","VICKIE","MATTIE","TERRY","MAXINE","IRMA","MABEL",
|
|
||||||
"MARSHA","MYRTLE","LENA","CHRISTY","DEANNA","PATSY","HILDA","GWENDOLYN","JENNIE","NORA","MARGIE","NINA","CASSANDRA","LEAH","PENNY",
|
|
||||||
"KAY","PRISCILLA","NAOMI","CAROLE","BRANDY","OLGA","BILLIE","DIANNE","TRACEY","LEONA","JENNY","FELICIA","SONIA","MIRIAM","VELMA",
|
|
||||||
"BECKY","BOBBIE","VIOLET","KRISTINA","TONI","MISTY","MAE","SHELLY","DAISY","RAMONA","SHERRI","ERIKA","KATRINA","CLAIRE","LINDSEY",
|
|
||||||
"LINDSAY","GENEVA","GUADALUPE","BELINDA","MARGARITA","SHERYL","CORA","FAYE","ADA","NATASHA","SABRINA","ISABEL","MARGUERITE",
|
|
||||||
"HATTIE","HARRIET","MOLLY","CECILIA","KRISTI","BRANDI","BLANCHE","SANDY","ROSIE","JOANNA","IRIS","EUNICE","ANGIE","INEZ","LYNDA",
|
|
||||||
"MADELINE","AMELIA","ALBERTA","GENEVIEVE","MONIQUE","JODI","JANIE","MAGGIE","KAYLA","SONYA","JAN","LEE","KRISTINE","CANDACE",
|
|
||||||
"FANNIE","MARYANN","OPAL","ALISON","YVETTE","MELODY","LUZ","SUSIE","OLIVIA","FLORA","SHELLEY","KRISTY","MAMIE","LULA","LOLA",
|
|
||||||
"VERNA","BEULAH","ANTOINETTE","CANDICE","JUANA","JEANNETTE","PAM","KELLI","HANNAH","WHITNEY","BRIDGET","KARLA","CELIA","LATOYA",
|
|
||||||
"PATTY","SHELIA","GAYLE","DELLA","VICKY","LYNNE","SHERI","MARIANNE","KARA","JACQUELYN","ERMA","BLANCA","MYRA","LETICIA","PAT",
|
|
||||||
"KRISTA","ROXANNE","ANGELICA","JOHNNIE","ROBYN","FRANCIS","ADRIENNE","ROSALIE","ALEXANDRA","BROOKE","BETHANY","SADIE","BERNADETTE",
|
|
||||||
"TRACI","JODY","KENDRA","JASMINE","NICHOLE","RACHAEL","CHELSEA","MABLE","ERNESTINE","MURIEL","MARCELLA","ELENA","KRYSTAL",
|
|
||||||
"ANGELINA","NADINE","KARI","ESTELLE","DIANNA","PAULETTE","LORA","MONA","DOREEN","ROSEMARIE","ANGEL","DESIREE","ANTONIA","HOPE",
|
|
||||||
"GINGER","JANIS","BETSY","CHRISTIE","FREDA","MERCEDES","MEREDITH","LYNETTE","TERI","CRISTINA","EULA","LEIGH","MEGHAN","SOPHIA",
|
|
||||||
"ELOISE","ROCHELLE","GRETCHEN","CECELIA","RAQUEL","HENRIETTA","ALYSSA","JANA","KELLEY","GWEN","KERRY","JENNA","TRICIA","LAVERNE",
|
|
||||||
"OLIVE","ALEXIS","TASHA","SILVIA","ELVIRA","CASEY","DELIA","SOPHIE","KATE","PATTI","LORENA","KELLIE","SONJA","LILA","LANA","DARLA",
|
|
||||||
"MAY","MINDY","ESSIE","MANDY","LORENE","ELSA","JOSEFINA","JEANNIE","MIRANDA","DIXIE","LUCIA","MARTA","FAITH","LELA","JOHANNA",
|
|
||||||
"SHARI","CAMILLE","TAMI","SHAWNA","ELISA","EBONY","MELBA","ORA","NETTIE","TABITHA","OLLIE","JAIME","WINIFRED","KRISTIE","MARINA",
|
|
||||||
"ALISHA","AIMEE","RENA","MYRNA","MARLA","TAMMIE","LATASHA","BONITA","PATRICE","RONDA","SHERRIE","ADDIE","FRANCINE","DELORIS",
|
|
||||||
"STACIE","ADRIANA","CHERI","SHELBY","ABIGAIL","CELESTE","JEWEL","CARA","ADELE","REBEKAH","LUCINDA","DORTHY","CHRIS","EFFIE",
|
|
||||||
"TRINA","REBA","SHAWN","SALLIE","AURORA","LENORA","ETTA","LOTTIE","KERRI","TRISHA","NIKKI","ESTELLA","FRANCISCA","JOSIE","TRACIE",
|
|
||||||
"MARISSA","KARIN","BRITTNEY","JANELLE","LOURDES","LAUREL","HELENE","FERN","ELVA","CORINNE","KELSEY","INA","BETTIE","ELISABETH",
|
|
||||||
"AIDA","CAITLIN","INGRID","IVA","EUGENIA","CHRISTA","GOLDIE","CASSIE","MAUDE","JENIFER","THERESE","FRANKIE","DENA","LORNA",
|
|
||||||
"JANETTE","LATONYA","CANDY","MORGAN","CONSUELO","TAMIKA","ROSETTA","DEBORA","CHERIE","POLLY","DINA","JEWELL","FAY","JILLIAN",
|
|
||||||
"DOROTHEA","NELL","TRUDY","ESPERANZA","PATRICA","KIMBERLEY","SHANNA","HELENA","CAROLINA","CLEO","STEFANIE","ROSARIO","OLA",
|
|
||||||
"JANINE","MOLLIE","LUPE","ALISA","LOU","MARIBEL","SUSANNE","BETTE","SUSANA","ELISE","CECILE","ISABELLE","LESLEY","JOCELYN",
|
|
||||||
"PAIGE","JONI","RACHELLE","LEOLA","DAPHNE","ALTA","ESTER","PETRA","GRACIELA","IMOGENE","JOLENE","KEISHA","LACEY","GLENNA",
|
|
||||||
"GABRIELA","KERI","URSULA","LIZZIE","KIRSTEN","SHANA","ADELINE","MAYRA","JAYNE","JACLYN","GRACIE","SONDRA","CARMELA","MARISA",
|
|
||||||
"ROSALIND","CHARITY","TONIA","BEATRIZ","MARISOL","CLARICE","JEANINE","SHEENA","ANGELINE","FRIEDA","LILY","ROBBIE","SHAUNA",
|
|
||||||
"MILLIE","CLAUDETTE","CATHLEEN","ANGELIA","GABRIELLE","AUTUMN","KATHARINE","SUMMER","JODIE","STACI","LEA","CHRISTI","JIMMIE",
|
|
||||||
"JUSTINE","ELMA","LUELLA","MARGRET","DOMINIQUE","SOCORRO","RENE","MARTINA","MARGO","MAVIS","CALLIE","BOBBI","MARITZA","LUCILE",
|
|
||||||
"LEANNE","JEANNINE","DEANA","AILEEN","LORIE","LADONNA","WILLA","MANUELA","GALE","SELMA","DOLLY","SYBIL","ABBY","LARA","DALE",
|
|
||||||
"IVY","DEE","WINNIE","MARCY","LUISA","JERI","MAGDALENA","OFELIA","MEAGAN","AUDRA","MATILDA","LEILA","CORNELIA","BIANCA","SIMONE",
|
|
||||||
"BETTYE","RANDI","VIRGIE","LATISHA","BARBRA","GEORGINA","ELIZA","LEANN","BRIDGETTE","RHODA","HALEY","ADELA","NOLA","BERNADINE",
|
|
||||||
"FLOSSIE","ILA","GRETA","RUTHIE","NELDA","MINERVA","LILLY","TERRIE","LETHA","HILARY","ESTELA","VALARIE","BRIANNA","ROSALYN",
|
|
||||||
"EARLINE","CATALINA","AVA","MIA","CLARISSA","LIDIA","CORRINE","ALEXANDRIA","CONCEPCION","TIA","SHARRON","RAE","DONA","ERICKA",
|
|
||||||
"JAMI","ELNORA","CHANDRA","LENORE","NEVA","MARYLOU","MELISA","TABATHA","SERENA","AVIS","ALLIE","SOFIA","JEANIE","ODESSA","NANNIE",
|
|
||||||
"HARRIETT","LORAINE","PENELOPE","MILAGROS","EMILIA","BENITA","ALLYSON","ASHLEE","TANIA","TOMMIE","ESMERALDA","KARINA","EVE",
|
|
||||||
"PEARLIE","ZELMA","MALINDA","NOREEN","TAMEKA","SAUNDRA","HILLARY","AMIE","ALTHEA","ROSALINDA","JORDAN","LILIA","ALANA","GAY",
|
|
||||||
"CLARE","ALEJANDRA","ELINOR","MICHAEL","LORRIE","JERRI","DARCY","EARNESTINE","CARMELLA","TAYLOR","NOEMI","MARCIE","LIZA",
|
|
||||||
"ANNABELLE","LOUISA","EARLENE","MALLORY","CARLENE","NITA","SELENA","TANISHA","KATY","JULIANNE","JOHN","LAKISHA","EDWINA",
|
|
||||||
"MARICELA","MARGERY","KENYA","DOLLIE","ROXIE","ROSLYN","KATHRINE","NANETTE","CHARMAINE","LAVONNE","ILENE","KRIS","TAMMI",
|
|
||||||
"SUZETTE","CORINE","KAYE","JERRY","MERLE","CHRYSTAL","LINA","DEANNE","LILIAN","JULIANA","ALINE","LUANN","KASEY","MARYANNE",
|
|
||||||
"EVANGELINE","COLETTE","MELVA","LAWANDA","YESENIA","NADIA","MADGE","KATHIE","EDDIE","OPHELIA","VALERIA","NONA","MITZI","MARI",
|
|
||||||
"GEORGETTE","CLAUDINE","FRAN","ALISSA","ROSEANN","LAKEISHA","SUSANNA","REVA","DEIDRE","CHASITY","SHEREE","CARLY","JAMES","ELVIA",
|
|
||||||
"ALYCE","DEIRDRE","GENA","BRIANA","ARACELI","KATELYN","ROSANNE","WENDI","TESSA","BERTA","MARVA","IMELDA","MARIETTA","MARCI",
|
|
||||||
"LEONOR","ARLINE","SASHA","MADELYN","JANNA","JULIETTE","DEENA","AURELIA","JOSEFA","AUGUSTA","LILIANA","YOUNG","CHRISTIAN",
|
|
||||||
"LESSIE","AMALIA","SAVANNAH","ANASTASIA","VILMA","NATALIA","ROSELLA","LYNNETTE","CORINA","ALFREDA","LEANNA","CAREY","AMPARO",
|
|
||||||
"COLEEN","TAMRA","AISHA","WILDA","KARYN","CHERRY","QUEEN","MAURA","MAI","EVANGELINA","ROSANNA","HALLIE","ERNA","ENID","MARIANA",
|
|
||||||
"LACY","JULIET","JACKLYN","FREIDA","MADELEINE","MARA","HESTER","CATHRYN","LELIA","CASANDRA","BRIDGETT","ANGELITA","JANNIE",
|
|
||||||
"DIONNE","ANNMARIE","KATINA","BERYL","PHOEBE","MILLICENT","KATHERYN","DIANN","CARISSA","MARYELLEN","LIZ","LAURI","HELGA","GILDA",
|
|
||||||
"ADRIAN","RHEA","MARQUITA","HOLLIE","TISHA","TAMERA","ANGELIQUE","FRANCESCA","BRITNEY","KAITLIN","LOLITA","FLORINE","ROWENA",
|
|
||||||
"REYNA","TWILA","FANNY","JANELL","INES","CONCETTA","BERTIE","ALBA","BRIGITTE","ALYSON","VONDA","PANSY","ELBA","NOELLE","LETITIA",
|
|
||||||
"KITTY","DEANN","BRANDIE","LOUELLA","LETA","FELECIA","SHARLENE","LESA","BEVERLEY","ROBERT","ISABELLA","HERMINIA","TERRA","CELINA",
|
|
||||||
"TORI","OCTAVIA","JADE","DENICE","GERMAINE","SIERRA","MICHELL","CORTNEY","NELLY","DORETHA","SYDNEY","DEIDRA","MONIKA","LASHONDA",
|
|
||||||
"JUDI","CHELSEY","ANTIONETTE","MARGOT","BOBBY","ADELAIDE","NAN","LEEANN","ELISHA","DESSIE","LIBBY","KATHI","GAYLA","LATANYA",
|
|
||||||
"MINA","MELLISA","KIMBERLEE","JASMIN","RENAE","ZELDA","ELDA","MA","JUSTINA","GUSSIE","EMILIE","CAMILLA","ABBIE","ROCIO","KAITLYN",
|
|
||||||
"JESSE","EDYTHE","ASHLEIGH","SELINA","LAKESHA","GERI","ALLENE","PAMALA","MICHAELA","DAYNA","CARYN","ROSALIA","SUN","JACQULINE",
|
|
||||||
"REBECA","MARYBETH","KRYSTLE","IOLA","DOTTIE","BENNIE","BELLE","AUBREY","GRISELDA","ERNESTINA","ELIDA","ADRIANNE","DEMETRIA",
|
|
||||||
"DELMA","CHONG","JAQUELINE","DESTINY","ARLEEN","VIRGINA","RETHA","FATIMA","TILLIE","ELEANORE","CARI","TREVA","BIRDIE","WILHELMINA",
|
|
||||||
"ROSALEE","MAURINE","LATRICE","YONG","JENA","TARYN","ELIA","DEBBY","MAUDIE","JEANNA","DELILAH","CATRINA","SHONDA","HORTENCIA",
|
|
||||||
"THEODORA","TERESITA","ROBBIN","DANETTE","MARYJANE","FREDDIE","DELPHINE","BRIANNE","NILDA","DANNA","CINDI","BESS","IONA","HANNA",
|
|
||||||
"ARIEL","WINONA","VIDA","ROSITA","MARIANNA","WILLIAM","RACHEAL","GUILLERMINA","ELOISA","CELESTINE","CAREN","MALISSA","LONA",
|
|
||||||
"CHANTEL","SHELLIE","MARISELA","LEORA","AGATHA","SOLEDAD","MIGDALIA","IVETTE","CHRISTEN","ATHENA","JANEL","CHLOE","VEDA","PATTIE",
|
|
||||||
"TESSIE","TERA","MARILYNN","LUCRETIA","KARRIE","DINAH","DANIELA","ALECIA","ADELINA","VERNICE","SHIELA","PORTIA","MERRY","LASHAWN",
|
|
||||||
"DEVON","DARA","TAWANA","OMA","VERDA","CHRISTIN","ALENE","ZELLA","SANDI","RAFAELA","MAYA","KIRA","CANDIDA","ALVINA","SUZAN",
|
|
||||||
"SHAYLA","LYN","LETTIE","ALVA","SAMATHA","ORALIA","MATILDE","MADONNA","LARISSA","VESTA","RENITA","INDIA","DELOIS","SHANDA",
|
|
||||||
"PHILLIS","LORRI","ERLINDA","CRUZ","CATHRINE","BARB","ZOE","ISABELL","IONE","GISELA","CHARLIE","VALENCIA","ROXANNA","MAYME",
|
|
||||||
"KISHA","ELLIE","MELLISSA","DORRIS","DALIA","BELLA","ANNETTA","ZOILA","RETA","REINA","LAURETTA","KYLIE","CHRISTAL","PILAR",
|
|
||||||
"CHARLA","ELISSA","TIFFANI","TANA","PAULINA","LEOTA","BREANNA","JAYME","CARMEL","VERNELL","TOMASA","MANDI","DOMINGA","SANTA",
|
|
||||||
"MELODIE","LURA","ALEXA","TAMELA","RYAN","MIRNA","KERRIE","VENUS","NOEL","FELICITA","CRISTY","CARMELITA","BERNIECE","ANNEMARIE",
|
|
||||||
"TIARA","ROSEANNE","MISSY","CORI","ROXANA","PRICILLA","KRISTAL","JUNG","ELYSE","HAYDEE","ALETHA","BETTINA","MARGE","GILLIAN",
|
|
||||||
"FILOMENA","CHARLES","ZENAIDA","HARRIETTE","CARIDAD","VADA","UNA","ARETHA","PEARLINE","MARJORY","MARCELA","FLOR","EVETTE",
|
|
||||||
"ELOUISE","ALINA","TRINIDAD","DAVID","DAMARIS","CATHARINE","CARROLL","BELVA","NAKIA","MARLENA","LUANNE","LORINE","KARON","DORENE",
|
|
||||||
"DANITA","BRENNA","TATIANA","SAMMIE","LOUANN","LOREN","JULIANNA","ANDRIA","PHILOMENA","LUCILA","LEONORA","DOVIE","ROMONA","MIMI",
|
|
||||||
"JACQUELIN","GAYE","TONJA","MISTI","JOE","GENE","CHASTITY","STACIA","ROXANN","MICAELA","NIKITA","MEI","VELDA","MARLYS","JOHNNA",
|
|
||||||
"AURA","LAVERN","IVONNE","HAYLEY","NICKI","MAJORIE","HERLINDA","GEORGE","ALPHA","YADIRA","PERLA","GREGORIA","DANIEL","ANTONETTE",
|
|
||||||
"SHELLI","MOZELLE","MARIAH","JOELLE","CORDELIA","JOSETTE","CHIQUITA","TRISTA","LOUIS","LAQUITA","GEORGIANA","CANDI","SHANON",
|
|
||||||
"LONNIE","HILDEGARD","CECIL","VALENTINA","STEPHANY","MAGDA","KAROL","GERRY","GABRIELLA","TIANA","ROMA","RICHELLE","RAY",
|
|
||||||
"PRINCESS","OLETA","JACQUE","IDELLA","ALAINA","SUZANNA","JOVITA","BLAIR","TOSHA","RAVEN","NEREIDA","MARLYN","KYLA","JOSEPH",
|
|
||||||
"DELFINA","TENA","STEPHENIE","SABINA","NATHALIE","MARCELLE","GERTIE","DARLEEN","THEA","SHARONDA","SHANTEL","BELEN","VENESSA",
|
|
||||||
"ROSALINA","ONA","GENOVEVA","COREY","CLEMENTINE","ROSALBA","RENATE","RENATA","MI","IVORY","GEORGIANNA","FLOY","DORCAS","ARIANA",
|
|
||||||
"TYRA","THEDA","MARIAM","JULI","JESICA","DONNIE","VIKKI","VERLA","ROSELYN","MELVINA","JANNETTE","GINNY","DEBRAH","CORRIE","ASIA",
|
|
||||||
"VIOLETA","MYRTIS","LATRICIA","COLLETTE","CHARLEEN","ANISSA","VIVIANA","TWYLA","PRECIOUS","NEDRA","LATONIA","LAN","HELLEN",
|
|
||||||
"FABIOLA","ANNAMARIE","ADELL","SHARYN","CHANTAL","NIKI","MAUD","LIZETTE","LINDY","KIA","KESHA","JEANA","DANELLE","CHARLINE",
|
|
||||||
"CHANEL","CARROL","VALORIE","LIA","DORTHA","CRISTAL","SUNNY","LEONE","LEILANI","GERRI","DEBI","ANDRA","KESHIA","IMA","EULALIA",
|
|
||||||
"EASTER","DULCE","NATIVIDAD","LINNIE","KAMI","GEORGIE","CATINA","BROOK","ALDA","WINNIFRED","SHARLA","RUTHANN","MEAGHAN",
|
|
||||||
"MAGDALENE","LISSETTE","ADELAIDA","VENITA","TRENA","SHIRLENE","SHAMEKA","ELIZEBETH","DIAN","SHANTA","MICKEY","LATOSHA","CARLOTTA",
|
|
||||||
"WINDY","SOON","ROSINA","MARIANN","LEISA","JONNIE","DAWNA","CATHIE","BILLY","ASTRID","SIDNEY","LAUREEN","JANEEN","HOLLI","FAWN",
|
|
||||||
"VICKEY","TERESSA","SHANTE","RUBYE","MARCELINA","CHANDA","CARY","TERESE","SCARLETT","MARTY","MARNIE","LULU","LISETTE","JENIFFER",
|
|
||||||
"ELENOR","DORINDA","DONITA","CARMAN","BERNITA","ALTAGRACIA","ALETA","ADRIANNA","ZORAIDA","RONNIE","NICOLA","LYNDSEY","KENDALL",
|
|
||||||
"JANINA","CHRISSY","AMI","STARLA","PHYLIS","PHUONG","KYRA","CHARISSE","BLANCH","SANJUANITA","RONA","NANCI","MARILEE","MARANDA",
|
|
||||||
"CORY","BRIGETTE","SANJUANA","MARITA","KASSANDRA","JOYCELYN","IRA","FELIPA","CHELSIE","BONNY","MIREYA","LORENZA","KYONG","ILEANA",
|
|
||||||
"CANDELARIA","TONY","TOBY","SHERIE","OK","MARK","LUCIE","LEATRICE","LAKESHIA","GERDA","EDIE","BAMBI","MARYLIN","LAVON","HORTENSE",
|
|
||||||
"GARNET","EVIE","TRESSA","SHAYNA","LAVINA","KYUNG","JEANETTA","SHERRILL","SHARA","PHYLISS","MITTIE","ANABEL","ALESIA","THUY",
|
|
||||||
"TAWANDA","RICHARD","JOANIE","TIFFANIE","LASHANDA","KARISSA","ENRIQUETA","DARIA","DANIELLA","CORINNA","ALANNA","ABBEY","ROXANE",
|
|
||||||
"ROSEANNA","MAGNOLIA","LIDA","KYLE","JOELLEN","ERA","CORAL","CARLEEN","TRESA","PEGGIE","NOVELLA","NILA","MAYBELLE","JENELLE",
|
|
||||||
"CARINA","NOVA","MELINA","MARQUERITE","MARGARETTE","JOSEPHINA","EVONNE","DEVIN","CINTHIA","ALBINA","TOYA","TAWNYA","SHERITA",
|
|
||||||
"SANTOS","MYRIAM","LIZABETH","LISE","KEELY","JENNI","GISELLE","CHERYLE","ARDITH","ARDIS","ALESHA","ADRIANE","SHAINA","LINNEA",
|
|
||||||
"KAROLYN","HONG","FLORIDA","FELISHA","DORI","DARCI","ARTIE","ARMIDA","ZOLA","XIOMARA","VERGIE","SHAMIKA","NENA","NANNETTE","MAXIE",
|
|
||||||
"LOVIE","JEANE","JAIMIE","INGE","FARRAH","ELAINA","CAITLYN","STARR","FELICITAS","CHERLY","CARYL","YOLONDA","YASMIN","TEENA",
|
|
||||||
"PRUDENCE","PENNIE","NYDIA","MACKENZIE","ORPHA","MARVEL","LIZBETH","LAURETTE","JERRIE","HERMELINDA","CAROLEE","TIERRA","MIRIAN",
|
|
||||||
"META","MELONY","KORI","JENNETTE","JAMILA","ENA","ANH","YOSHIKO","SUSANNAH","SALINA","RHIANNON","JOLEEN","CRISTINE","ASHTON",
|
|
||||||
"ARACELY","TOMEKA","SHALONDA","MARTI","LACIE","KALA","JADA","ILSE","HAILEY","BRITTANI","ZONA","SYBLE","SHERRYL","RANDY","NIDIA",
|
|
||||||
"MARLO","KANDICE","KANDI","DEB","DEAN","AMERICA","ALYCIA","TOMMY","RONNA","NORENE","MERCY","JOSE","INGEBORG","GIOVANNA","GEMMA",
|
|
||||||
"CHRISTEL","AUDRY","ZORA","VITA","VAN","TRISH","STEPHAINE","SHIRLEE","SHANIKA","MELONIE","MAZIE","JAZMIN","INGA","HOA","HETTIE",
|
|
||||||
"GERALYN","FONDA","ESTRELLA","ADELLA","SU","SARITA","RINA","MILISSA","MARIBETH","GOLDA","EVON","ETHELYN","ENEDINA","CHERISE",
|
|
||||||
"CHANA","VELVA","TAWANNA","SADE","MIRTA","LI","KARIE","JACINTA","ELNA","DAVINA","CIERRA","ASHLIE","ALBERTHA","TANESHA","STEPHANI",
|
|
||||||
"NELLE","MINDI","LU","LORINDA","LARUE","FLORENE","DEMETRA","DEDRA","CIARA","CHANTELLE","ASHLY","SUZY","ROSALVA","NOELIA","LYDA",
|
|
||||||
"LEATHA","KRYSTYNA","KRISTAN","KARRI","DARLINE","DARCIE","CINDA","CHEYENNE","CHERRIE","AWILDA","ALMEDA","ROLANDA","LANETTE",
|
|
||||||
"JERILYN","GISELE","EVALYN","CYNDI","CLETA","CARIN","ZINA","ZENA","VELIA","TANIKA","PAUL","CHARISSA","THOMAS","TALIA","MARGARETE",
|
|
||||||
"LAVONDA","KAYLEE","KATHLENE","JONNA","IRENA","ILONA","IDALIA","CANDIS","CANDANCE","BRANDEE","ANITRA","ALIDA","SIGRID","NICOLETTE",
|
|
||||||
"MARYJO","LINETTE","HEDWIG","CHRISTIANA","CASSIDY","ALEXIA","TRESSIE","MODESTA","LUPITA","LITA","GLADIS","EVELIA","DAVIDA",
|
|
||||||
"CHERRI","CECILY","ASHELY","ANNABEL","AGUSTINA","WANITA","SHIRLY","ROSAURA","HULDA","EUN","BAILEY","YETTA","VERONA","THOMASINA",
|
|
||||||
"SIBYL","SHANNAN","MECHELLE","LUE","LEANDRA","LANI","KYLEE","KANDY","JOLYNN","FERNE","EBONI","CORENE","ALYSIA","ZULA","NADA",
|
|
||||||
"MOIRA","LYNDSAY","LORRETTA","JUAN","JAMMIE","HORTENSIA","GAYNELL","CAMERON","ADRIA","VINA","VICENTA","TANGELA","STEPHINE",
|
|
||||||
"NORINE","NELLA","LIANA","LESLEE","KIMBERELY","ILIANA","GLORY","FELICA","EMOGENE","ELFRIEDE","EDEN","EARTHA","CARMA","BEA","OCIE",
|
|
||||||
"MARRY","LENNIE","KIARA","JACALYN","CARLOTA","ARIELLE","YU","STAR","OTILIA","KIRSTIN","KACEY","JOHNETTA","JOEY","JOETTA",
|
|
||||||
"JERALDINE","JAUNITA","ELANA","DORTHEA","CAMI","AMADA","ADELIA","VERNITA","TAMAR","SIOBHAN","RENEA","RASHIDA","OUIDA","ODELL",
|
|
||||||
"NILSA","MERYL","KRISTYN","JULIETA","DANICA","BREANNE","AUREA","ANGLEA","SHERRON","ODETTE","MALIA","LORELEI","LIN","LEESA",
|
|
||||||
"KENNA","KATHLYN","FIONA","CHARLETTE","SUZIE","SHANTELL","SABRA","RACQUEL","MYONG","MIRA","MARTINE","LUCIENNE","LAVADA","JULIANN",
|
|
||||||
"JOHNIE","ELVERA","DELPHIA","CLAIR","CHRISTIANE","CHAROLETTE","CARRI","AUGUSTINE","ASHA","ANGELLA","PAOLA","NINFA","LEDA","LAI",
|
|
||||||
"EDA","SUNSHINE","STEFANI","SHANELL","PALMA","MACHELLE","LISSA","KECIA","KATHRYNE","KARLENE","JULISSA","JETTIE","JENNIFFER","HUI",
|
|
||||||
"CORRINA","CHRISTOPHER","CAROLANN","ALENA","TESS","ROSARIA","MYRTICE","MARYLEE","LIANE","KENYATTA","JUDIE","JANEY","IN","ELMIRA",
|
|
||||||
"ELDORA","DENNA","CRISTI","CATHI","ZAIDA","VONNIE","VIVA","VERNIE","ROSALINE","MARIELA","LUCIANA","LESLI","KARAN","FELICE",
|
|
||||||
"DENEEN","ADINA","WYNONA","TARSHA","SHERON","SHASTA","SHANITA","SHANI","SHANDRA","RANDA","PINKIE","PARIS","NELIDA","MARILOU",
|
|
||||||
"LYLA","LAURENE","LACI","JOI","JANENE","DOROTHA","DANIELE","DANI","CAROLYNN","CARLYN","BERENICE","AYESHA","ANNELIESE","ALETHEA",
|
|
||||||
"THERSA","TAMIKO","RUFINA","OLIVA","MOZELL","MARYLYN","MADISON","KRISTIAN","KATHYRN","KASANDRA","KANDACE","JANAE","GABRIEL",
|
|
||||||
"DOMENICA","DEBBRA","DANNIELLE","CHUN","BUFFY","BARBIE","ARCELIA","AJA","ZENOBIA","SHAREN","SHAREE","PATRICK","PAGE","MY",
|
|
||||||
"LAVINIA","KUM","KACIE","JACKELINE","HUONG","FELISA","EMELIA","ELEANORA","CYTHIA","CRISTIN","CLYDE","CLARIBEL","CARON",
|
|
||||||
"ANASTACIA","ZULMA","ZANDRA","YOKO","TENISHA","SUSANN","SHERILYN","SHAY","SHAWANDA","SABINE","ROMANA","MATHILDA","LINSEY",
|
|
||||||
"KEIKO","JOANA","ISELA","GRETTA","GEORGETTA","EUGENIE","DUSTY","DESIRAE","DELORA","CORAZON","ANTONINA","ANIKA","WILLENE","TRACEE",
|
|
||||||
"TAMATHA","REGAN","NICHELLE","MICKIE","MAEGAN","LUANA","LANITA","KELSIE","EDELMIRA","BREE","AFTON","TEODORA","TAMIE","SHENA",
|
|
||||||
"MEG","LINH","KELI","KACI","DANYELLE","BRITT","ARLETTE","ALBERTINE","ADELLE","TIFFINY","STORMY","SIMONA","NUMBERS","NICOLASA",
|
|
||||||
"NICHOL","NIA","NAKISHA","MEE","MAIRA","LOREEN","KIZZY","JOHNNY","JAY","FALLON","CHRISTENE","BOBBYE","ANTHONY","YING","VINCENZA",
|
|
||||||
"TANJA","RUBIE","RONI","QUEENIE","MARGARETT","KIMBERLI","IRMGARD","IDELL","HILMA","EVELINA","ESTA","EMILEE","DENNISE","DANIA",
|
|
||||||
"CARL","CARIE","ANTONIO","WAI","SANG","RISA","RIKKI","PARTICIA","MUI","MASAKO","MARIO","LUVENIA","LOREE","LONI","LIEN","KEVIN",
|
|
||||||
"GIGI","FLORENCIA","DORIAN","DENITA","DALLAS","CHI","BILLYE","ALEXANDER","TOMIKA","SHARITA","RANA","NIKOLE","NEOMA","MARGARITE",
|
|
||||||
"MADALYN","LUCINA","LAILA","KALI","JENETTE","GABRIELE","EVELYNE","ELENORA","CLEMENTINA","ALEJANDRINA","ZULEMA","VIOLETTE",
|
|
||||||
"VANNESSA","THRESA","RETTA","PIA","PATIENCE","NOELLA","NICKIE","JONELL","DELTA","CHUNG","CHAYA","CAMELIA","BETHEL","ANYA",
|
|
||||||
"ANDREW","THANH","SUZANN","SPRING","SHU","MILA","LILLA","LAVERNA","KEESHA","KATTIE","GIA","GEORGENE","EVELINE","ESTELL","ELIZBETH",
|
|
||||||
"VIVIENNE","VALLIE","TRUDIE","STEPHANE","MICHEL","MAGALY","MADIE","KENYETTA","KARREN","JANETTA","HERMINE","HARMONY","DRUCILLA",
|
|
||||||
"DEBBI","CELESTINA","CANDIE","BRITNI","BECKIE","AMINA","ZITA","YUN","YOLANDE","VIVIEN","VERNETTA","TRUDI","SOMMER","PEARLE",
|
|
||||||
"PATRINA","OSSIE","NICOLLE","LOYCE","LETTY","LARISA","KATHARINA","JOSELYN","JONELLE","JENELL","IESHA","HEIDE","FLORINDA",
|
|
||||||
"FLORENTINA","FLO","ELODIA","DORINE","BRUNILDA","BRIGID","ASHLI","ARDELLA","TWANA","THU","TARAH","SUNG","SHEA","SHAVON","SHANE",
|
|
||||||
"SERINA","RAYNA","RAMONITA","NGA","MARGURITE","LUCRECIA","KOURTNEY","KATI","JESUS","JESENIA","DIAMOND","CRISTA","AYANA","ALICA",
|
|
||||||
"ALIA","VINNIE","SUELLEN","ROMELIA","RACHELL","PIPER","OLYMPIA","MICHIKO","KATHALEEN","JOLIE","JESSI","JANESSA","HANA","HA",
|
|
||||||
"ELEASE","CARLETTA","BRITANY","SHONA","SALOME","ROSAMOND","REGENA","RAINA","NGOC","NELIA","LOUVENIA","LESIA","LATRINA","LATICIA",
|
|
||||||
"LARHONDA","JINA","JACKI","HOLLIS","HOLLEY","EMMY","DEEANN","CORETTA","ARNETTA","VELVET","THALIA","SHANICE","NETA","MIKKI","MICKI",
|
|
||||||
"LONNA","LEANA","LASHUNDA","KILEY","JOYE","JACQULYN","IGNACIA","HYUN","HIROKO","HENRY","HENRIETTE","ELAYNE","DELINDA","DARNELL",
|
|
||||||
"DAHLIA","COREEN","CONSUELA","CONCHITA","CELINE","BABETTE","AYANNA","ANETTE","ALBERTINA","SKYE","SHAWNEE","SHANEKA","QUIANA",
|
|
||||||
"PAMELIA","MIN","MERRI","MERLENE","MARGIT","KIESHA","KIERA","KAYLENE","JODEE","JENISE","ERLENE","EMMIE","ELSE","DARYL","DALILA",
|
|
||||||
"DAISEY","CODY","CASIE","BELIA","BABARA","VERSIE","VANESA","SHELBA","SHAWNDA","SAM","NORMAN","NIKIA","NAOMA","MARNA","MARGERET",
|
|
||||||
"MADALINE","LAWANA","KINDRA","JUTTA","JAZMINE","JANETT","HANNELORE","GLENDORA","GERTRUD","GARNETT","FREEDA","FREDERICA","FLORANCE",
|
|
||||||
"FLAVIA","DENNIS","CARLINE","BEVERLEE","ANJANETTE","VALDA","TRINITY","TAMALA","STEVIE","SHONNA","SHA","SARINA","ONEIDA","MICAH",
|
|
||||||
"MERILYN","MARLEEN","LURLINE","LENNA","KATHERIN","JIN","JENI","HAE","GRACIA","GLADY","FARAH","ERIC","ENOLA","EMA","DOMINQUE",
|
|
||||||
"DEVONA","DELANA","CECILA","CAPRICE","ALYSHA","ALI","ALETHIA","VENA","THERESIA","TAWNY","SONG","SHAKIRA","SAMARA","SACHIKO",
|
|
||||||
"RACHELE","PAMELLA","NICKY","MARNI","MARIEL","MAREN","MALISA","LIGIA","LERA","LATORIA","LARAE","KIMBER","KATHERN","KAREY",
|
|
||||||
"JENNEFER","JANETH","HALINA","FREDIA","DELISA","DEBROAH","CIERA","CHIN","ANGELIKA","ANDREE","ALTHA","YEN","VIVAN","TERRESA",
|
|
||||||
"TANNA","SUK","SUDIE","SOO","SIGNE","SALENA","RONNI","REBBECCA","MYRTIE","MCKENZIE","MALIKA","MAIDA","LOAN","LEONARDA","KAYLEIGH",
|
|
||||||
"FRANCE","ETHYL","ELLYN","DAYLE","CAMMIE","BRITTNI","BIRGIT","AVELINA","ASUNCION","ARIANNA","AKIKO","VENICE","TYESHA","TONIE",
|
|
||||||
"TIESHA","TAKISHA","STEFFANIE","SINDY","SANTANA","MEGHANN","MANDA","MACIE","LADY","KELLYE","KELLEE","JOSLYN","JASON","INGER",
|
|
||||||
"INDIRA","GLINDA","GLENNIS","FERNANDA","FAUSTINA","ENEIDA","ELICIA","DOT","DIGNA","DELL","ARLETTA","ANDRE","WILLIA","TAMMARA",
|
|
||||||
"TABETHA","SHERRELL","SARI","REFUGIO","REBBECA","PAULETTA","NIEVES","NATOSHA","NAKITA","MAMMIE","KENISHA","KAZUKO","KASSIE",
|
|
||||||
"GARY","EARLEAN","DAPHINE","CORLISS","CLOTILDE","CAROLYNE","BERNETTA","AUGUSTINA","AUDREA","ANNIS","ANNABELL","YAN","TENNILLE",
|
|
||||||
"TAMICA","SELENE","SEAN","ROSANA","REGENIA","QIANA","MARKITA","MACY","LEEANNE","LAURINE","KYM","JESSENIA","JANITA","GEORGINE",
|
|
||||||
"GENIE","EMIKO","ELVIE","DEANDRA","DAGMAR","CORIE","COLLEN","CHERISH","ROMAINE","PORSHA","PEARLENE","MICHELINE","MERNA","MARGORIE",
|
|
||||||
"MARGARETTA","LORE","KENNETH","JENINE","HERMINA","FREDERICKA","ELKE","DRUSILLA","DORATHY","DIONE","DESIRE","CELENA","BRIGIDA",
|
|
||||||
"ANGELES","ALLEGRA","THEO","TAMEKIA","SYNTHIA","STEPHEN","SOOK","SLYVIA","ROSANN","REATHA","RAYE","MARQUETTA","MARGART","LING",
|
|
||||||
"LAYLA","KYMBERLY","KIANA","KAYLEEN","KATLYN","KARMEN","JOELLA","IRINA","EMELDA","ELENI","DETRA","CLEMMIE","CHERYLL","CHANTELL",
|
|
||||||
"CATHEY","ARNITA","ARLA","ANGLE","ANGELIC","ALYSE","ZOFIA","THOMASINE","TENNIE","SON","SHERLY","SHERLEY","SHARYL","REMEDIOS",
|
|
||||||
"PETRINA","NICKOLE","MYUNG","MYRLE","MOZELLA","LOUANNE","LISHA","LATIA","LANE","KRYSTA","JULIENNE","JOEL","JEANENE","JACQUALINE",
|
|
||||||
"ISAURA","GWENDA","EARLEEN","DONALD","CLEOPATRA","CARLIE","AUDIE","ANTONIETTA","ALISE","ALEX","VERDELL","VAL","TYLER","TOMOKO",
|
|
||||||
"THAO","TALISHA","STEVEN","SO","SHEMIKA","SHAUN","SCARLET","SAVANNA","SANTINA","ROSIA","RAEANN","ODILIA","NANA","MINNA","MAGAN",
|
|
||||||
"LYNELLE","LE","KARMA","JOEANN","IVANA","INELL","ILANA","HYE","HONEY","HEE","GUDRUN","FRANK","DREAMA","CRISSY","CHANTE",
|
|
||||||
"CARMELINA","ARVILLA","ARTHUR","ANNAMAE","ALVERA","ALEIDA","AARON","YEE","YANIRA","VANDA","TIANNA","TAM","STEFANIA","SHIRA",
|
|
||||||
"PERRY","NICOL","NANCIE","MONSERRATE","MINH","MELYNDA","MELANY","MATTHEW","LOVELLA","LAURE","KIRBY","KACY","JACQUELYNN","HYON",
|
|
||||||
"GERTHA","FRANCISCO","ELIANA","CHRISTENA","CHRISTEEN","CHARISE","CATERINA","CARLEY","CANDYCE","ARLENA","AMMIE","YANG","WILLETTE",
|
|
||||||
"VANITA","TUYET","TINY","SYREETA","SILVA","SCOTT","RONALD","PENNEY","NYLA","MICHAL","MAURICE","MARYAM","MARYA","MAGEN","LUDIE",
|
|
||||||
"LOMA","LIVIA","LANELL","KIMBERLIE","JULEE","DONETTA","DIEDRA","DENISHA","DEANE","DAWNE","CLARINE","CHERRYL","BRONWYN","BRANDON",
|
|
||||||
"ALLA","VALERY","TONDA","SUEANN","SORAYA","SHOSHANA","SHELA","SHARLEEN","SHANELLE","NERISSA","MICHEAL","MERIDITH","MELLIE","MAYE",
|
|
||||||
"MAPLE","MAGARET","LUIS","LILI","LEONILA","LEONIE","LEEANNA","LAVONIA","LAVERA","KRISTEL","KATHEY","KATHE","JUSTIN","JULIAN",
|
|
||||||
"JIMMY","JANN","ILDA","HILDRED","HILDEGARDE","GENIA","FUMIKO","EVELIN","ERMELINDA","ELLY","DUNG","DOLORIS","DIONNA","DANAE",
|
|
||||||
"BERNEICE","ANNICE","ALIX","VERENA","VERDIE","TRISTAN","SHAWNNA","SHAWANA","SHAUNNA","ROZELLA","RANDEE","RANAE","MILAGRO",
|
|
||||||
"LYNELL","LUISE","LOUIE","LOIDA","LISBETH","KARLEEN","JUNITA","JONA","ISIS","HYACINTH","HEDY","GWENN","ETHELENE","ERLINE",
|
|
||||||
"EDWARD","DONYA","DOMONIQUE","DELICIA","DANNETTE","CICELY","BRANDA","BLYTHE","BETHANN","ASHLYN","ANNALEE","ALLINE","YUKO","VELLA",
|
|
||||||
"TRANG","TOWANDA","TESHA","SHERLYN","NARCISA","MIGUELINA","MERI","MAYBELL","MARLANA","MARGUERITA","MADLYN","LUNA","LORY",
|
|
||||||
"LORIANN","LIBERTY","LEONORE","LEIGHANN","LAURICE","LATESHA","LARONDA","KATRICE","KASIE","KARL","KALEY","JADWIGA","GLENNIE",
|
|
||||||
"GEARLDINE","FRANCINA","EPIFANIA","DYAN","DORIE","DIEDRE","DENESE","DEMETRICE","DELENA","DARBY","CRISTIE","CLEORA","CATARINA",
|
|
||||||
"CARISA","BERNIE","BARBERA","ALMETA","TRULA","TEREASA","SOLANGE","SHEILAH","SHAVONNE","SANORA","ROCHELL","MATHILDE","MARGARETA",
|
|
||||||
"MAIA","LYNSEY","LAWANNA","LAUNA","KENA","KEENA","KATIA","JAMEY","GLYNDA","GAYLENE","ELVINA","ELANOR","DANUTA","DANIKA","CRISTEN",
|
|
||||||
"CORDIE","COLETTA","CLARITA","CARMON","BRYNN","AZUCENA","AUNDREA","ANGELE","YI","WALTER","VERLIE","VERLENE","TAMESHA","SILVANA",
|
|
||||||
"SEBRINA","SAMIRA","REDA","RAYLENE","PENNI","PANDORA","NORAH","NOMA","MIREILLE","MELISSIA","MARYALICE","LARAINE","KIMBERY",
|
|
||||||
"KARYL","KARINE","KAM","JOLANDA","JOHANA","JESUSA","JALEESA","JAE","JACQUELYNE","IRISH","ILUMINADA","HILARIA","HANH","GENNIE",
|
|
||||||
"FRANCIE","FLORETTA","EXIE","EDDA","DREMA","DELPHA","BEV","BARBAR","ASSUNTA","ARDELL","ANNALISA","ALISIA","YUKIKO","YOLANDO",
|
|
||||||
"WONDA","WEI","WALTRAUD","VETA","TEQUILA","TEMEKA","TAMEIKA","SHIRLEEN","SHENITA","PIEDAD","OZELLA","MIRTHA","MARILU","KIMIKO",
|
|
||||||
"JULIANE","JENICE","JEN","JANAY","JACQUILINE","HILDE","FE","FAE","EVAN","EUGENE","ELOIS","ECHO","DEVORAH","CHAU","BRINDA",
|
|
||||||
"BETSEY","ARMINDA","ARACELIS","APRYL","ANNETT","ALISHIA","VEOLA","USHA","TOSHIKO","THEOLA","TASHIA","TALITHA","SHERY","RUDY",
|
|
||||||
"RENETTA","REIKO","RASHEEDA","OMEGA","OBDULIA","MIKA","MELAINE","MEGGAN","MARTIN","MARLEN","MARGET","MARCELINE","MANA","MAGDALEN",
|
|
||||||
"LIBRADA","LEZLIE","LEXIE","LATASHIA","LASANDRA","KELLE","ISIDRA","ISA","INOCENCIA","GWYN","FRANCOISE","ERMINIA","ERINN","DIMPLE",
|
|
||||||
"DEVORA","CRISELDA","ARMANDA","ARIE","ARIANE","ANGELO","ANGELENA","ALLEN","ALIZA","ADRIENE","ADALINE","XOCHITL","TWANNA","TRAN",
|
|
||||||
"TOMIKO","TAMISHA","TAISHA","SUSY","SIU","RUTHA","ROXY","RHONA","RAYMOND","OTHA","NORIKO","NATASHIA","MERRIE","MELVIN","MARINDA",
|
|
||||||
"MARIKO","MARGERT","LORIS","LIZZETTE","LEISHA","KAILA","KA","JOANNIE","JERRICA","JENE","JANNET","JANEE","JACINDA","HERTA",
|
|
||||||
"ELENORE","DORETTA","DELAINE","DANIELL","CLAUDIE","CHINA","BRITTA","APOLONIA","AMBERLY","ALEASE","YURI","YUK","WEN","WANETA",
|
|
||||||
"UTE","TOMI","SHARRI","SANDIE","ROSELLE","REYNALDA","RAGUEL","PHYLICIA","PATRIA","OLIMPIA","ODELIA","MITZIE","MITCHELL","MISS",
|
|
||||||
"MINDA","MIGNON","MICA","MENDY","MARIVEL","MAILE","LYNETTA","LAVETTE","LAURYN","LATRISHA","LAKIESHA","KIERSTEN","KARY","JOSPHINE",
|
|
||||||
"JOLYN","JETTA","JANISE","JACQUIE","IVELISSE","GLYNIS","GIANNA","GAYNELLE","EMERALD","DEMETRIUS","DANYELL","DANILLE","DACIA",
|
|
||||||
"CORALEE","CHER","CEOLA","BRETT","BELL","ARIANNE","ALESHIA","YUNG","WILLIEMAE","TROY","TRINH","THORA","TAI","SVETLANA","SHERIKA",
|
|
||||||
"SHEMEKA","SHAUNDA","ROSELINE","RICKI","MELDA","MALLIE","LAVONNA","LATINA","LARRY","LAQUANDA","LALA","LACHELLE","KLARA","KANDIS",
|
|
||||||
"JOHNA","JEANMARIE","JAYE","HANG","GRAYCE","GERTUDE","EMERITA","EBONIE","CLORINDA","CHING","CHERY","CAROLA","BREANN","BLOSSOM",
|
|
||||||
"BERNARDINE","BECKI","ARLETHA","ARGELIA","ARA","ALITA","YULANDA","YON","YESSENIA","TOBI","TASIA","SYLVIE","SHIRL","SHIRELY",
|
|
||||||
"SHERIDAN","SHELLA","SHANTELLE","SACHA","ROYCE","REBECKA","REAGAN","PROVIDENCIA","PAULENE","MISHA","MIKI","MARLINE","MARICA",
|
|
||||||
"LORITA","LATOYIA","LASONYA","KERSTIN","KENDA","KEITHA","KATHRIN","JAYMIE","JACK","GRICELDA","GINETTE","ERYN","ELINA","ELFRIEDA",
|
|
||||||
"DANYEL","CHEREE","CHANELLE","BARRIE","AVERY","AURORE","ANNAMARIA","ALLEEN","AILENE","AIDE","YASMINE","VASHTI","VALENTINE",
|
|
||||||
"TREASA","TORY","TIFFANEY","SHERYLL","SHARIE","SHANAE","SAU","RAISA","PA","NEDA","MITSUKO","MIRELLA","MILDA","MARYANNA","MARAGRET",
|
|
||||||
"MABELLE","LUETTA","LORINA","LETISHA","LATARSHA","LANELLE","LAJUANA","KRISSY","KARLY","KARENA","JON","JESSIKA","JERICA","JEANELLE",
|
|
||||||
"JANUARY","JALISA","JACELYN","IZOLA","IVEY","GREGORY","EUNA","ETHA","DREW","DOMITILA","DOMINICA","DAINA","CREOLA","CARLI","CAMIE",
|
|
||||||
"BUNNY","BRITTNY","ASHANTI","ANISHA","ALEEN","ADAH","YASUKO","WINTER","VIKI","VALRIE","TONA","TINISHA","THI","TERISA","TATUM",
|
|
||||||
"TANEKA","SIMONNE","SHALANDA","SERITA","RESSIE","REFUGIA","PAZ","OLENE","NA","MERRILL","MARGHERITA","MANDIE","MAN","MAIRE",
|
|
||||||
"LYNDIA","LUCI","LORRIANE","LORETA","LEONIA","LAVONA","LASHAWNDA","LAKIA","KYOKO","KRYSTINA","KRYSTEN","KENIA","KELSI","JUDE",
|
|
||||||
"JEANICE","ISOBEL","GEORGIANN","GENNY","FELICIDAD","EILENE","DEON","DELOISE","DEEDEE","DANNIE","CONCEPTION","CLORA","CHERILYN",
|
|
||||||
"CHANG","CALANDRA","BERRY","ARMANDINA","ANISA","ULA","TIMOTHY","TIERA","THERESSA","STEPHANIA","SIMA","SHYLA","SHONTA","SHERA",
|
|
||||||
"SHAQUITA","SHALA","SAMMY","ROSSANA","NOHEMI","NERY","MORIAH","MELITA","MELIDA","MELANI","MARYLYNN","MARISHA","MARIETTE","MALORIE",
|
|
||||||
"MADELENE","LUDIVINA","LORIA","LORETTE","LORALEE","LIANNE","LEON","LAVENIA","LAURINDA","LASHON","KIT","KIMI","KEILA","KATELYNN",
|
|
||||||
"KAI","JONE","JOANE","JI","JAYNA","JANELLA","JA","HUE","HERTHA","FRANCENE","ELINORE","DESPINA","DELSIE","DEEDRA","CLEMENCIA",
|
|
||||||
"CARRY","CAROLIN","CARLOS","BULAH","BRITTANIE","BOK","BLONDELL","BIBI","BEAULAH","BEATA","ANNITA","AGRIPINA","VIRGEN","VALENE",
|
|
||||||
"UN","TWANDA","TOMMYE","TOI","TARRA","TARI","TAMMERA","SHAKIA","SADYE","RUTHANNE","ROCHEL","RIVKA","PURA","NENITA","NATISHA",
|
|
||||||
"MING","MERRILEE","MELODEE","MARVIS","LUCILLA","LEENA","LAVETA","LARITA","LANIE","KEREN","ILEEN","GEORGEANN","GENNA","GENESIS",
|
|
||||||
"FRIDA","EWA","EUFEMIA","EMELY","ELA","EDYTH","DEONNA","DEADRA","DARLENA","CHANELL","CHAN","CATHERN","CASSONDRA","CASSAUNDRA",
|
|
||||||
"BERNARDA","BERNA","ARLINDA","ANAMARIA","ALBERT","WESLEY","VERTIE","VALERI","TORRI","TATYANA","STASIA","SHERISE","SHERILL",
|
|
||||||
"SEASON","SCOTTIE","SANDA","RUTHE","ROSY","ROBERTO","ROBBI","RANEE","QUYEN","PEARLY","PALMIRA","ONITA","NISHA","NIESHA","NIDA",
|
|
||||||
"NEVADA","NAM","MERLYN","MAYOLA","MARYLOUISE","MARYLAND","MARX","MARTH","MARGENE","MADELAINE","LONDA","LEONTINE","LEOMA","LEIA",
|
|
||||||
"LAWRENCE","LAURALEE","LANORA","LAKITA","KIYOKO","KETURAH","KATELIN","KAREEN","JONIE","JOHNETTE","JENEE","JEANETT","IZETTA",
|
|
||||||
"HIEDI","HEIKE","HASSIE","HAROLD","GIUSEPPINA","GEORGANN","FIDELA","FERNANDE","ELWANDA","ELLAMAE","ELIZ","DUSTI","DOTTY","CYNDY",
|
|
||||||
"CORALIE","CELESTA","ARGENTINA","ALVERTA","XENIA","WAVA","VANETTA","TORRIE","TASHINA","TANDY","TAMBRA","TAMA","STEPANIE","SHILA",
|
|
||||||
"SHAUNTA","SHARAN","SHANIQUA","SHAE","SETSUKO","SERAFINA","SANDEE","ROSAMARIA","PRISCILA","OLINDA","NADENE","MUOI","MICHELINA",
|
|
||||||
"MERCEDEZ","MARYROSE","MARIN","MARCENE","MAO","MAGALI","MAFALDA","LOGAN","LINN","LANNIE","KAYCE","KAROLINE","KAMILAH","KAMALA",
|
|
||||||
"JUSTA","JOLINE","JENNINE","JACQUETTA","IRAIDA","GERALD","GEORGEANNA","FRANCHESCA","FAIRY","EMELINE","ELANE","EHTEL","EARLIE",
|
|
||||||
"DULCIE","DALENE","CRIS","CLASSIE","CHERE","CHARIS","CAROYLN","CARMINA","CARITA","BRIAN","BETHANIE","AYAKO","ARICA","AN","ALYSA",
|
|
||||||
"ALESSANDRA","AKILAH","ADRIEN","ZETTA","YOULANDA","YELENA","YAHAIRA","XUAN","WENDOLYN","VICTOR","TIJUANA","TERRELL","TERINA",
|
|
||||||
"TERESIA","SUZI","SUNDAY","SHERELL","SHAVONDA","SHAUNTE","SHARDA","SHAKITA","SENA","RYANN","RUBI","RIVA","REGINIA","REA","RACHAL",
|
|
||||||
"PARTHENIA","PAMULA","MONNIE","MONET","MICHAELE","MELIA","MARINE","MALKA","MAISHA","LISANDRA","LEO","LEKISHA","LEAN","LAURENCE",
|
|
||||||
"LAKENDRA","KRYSTIN","KORTNEY","KIZZIE","KITTIE","KERA","KENDAL","KEMBERLY","KANISHA","JULENE","JULE","JOSHUA","JOHANNE","JEFFREY",
|
|
||||||
"JAMEE","HAN","HALLEY","GIDGET","GALINA","FREDRICKA","FLETA","FATIMAH","EUSEBIA","ELZA","ELEONORE","DORTHEY","DORIA","DONELLA",
|
|
||||||
"DINORAH","DELORSE","CLARETHA","CHRISTINIA","CHARLYN","BONG","BELKIS","AZZIE","ANDERA","AIKO","ADENA","YER","YAJAIRA","WAN",
|
|
||||||
"VANIA","ULRIKE","TOSHIA","TIFANY","STEFANY","SHIZUE","SHENIKA","SHAWANNA","SHAROLYN","SHARILYN","SHAQUANA","SHANTAY","SEE",
|
|
||||||
"ROZANNE","ROSELEE","RICKIE","REMONA","REANNA","RAELENE","QUINN","PHUNG","PETRONILA","NATACHA","NANCEY","MYRL","MIYOKO","MIESHA",
|
|
||||||
"MERIDETH","MARVELLA","MARQUITTA","MARHTA","MARCHELLE","LIZETH","LIBBIE","LAHOMA","LADAWN","KINA","KATHELEEN","KATHARYN","KARISA",
|
|
||||||
"KALEIGH","JUNIE","JULIEANN","JOHNSIE","JANEAN","JAIMEE","JACKQUELINE","HISAKO","HERMA","HELAINE","GWYNETH","GLENN","GITA",
|
|
||||||
"EUSTOLIA","EMELINA","ELIN","EDRIS","DONNETTE","DONNETTA","DIERDRE","DENAE","DARCEL","CLAUDE","CLARISA","CINDERELLA","CHIA",
|
|
||||||
"CHARLESETTA","CHARITA","CELSA","CASSY","CASSI","CARLEE","BRUNA","BRITTANEY","BRANDE","BILLI","BAO","ANTONETTA","ANGLA","ANGELYN",
|
|
||||||
"ANALISA","ALANE","WENONA","WENDIE","VERONIQUE","VANNESA","TOBIE","TEMPIE","SUMIKO","SULEMA","SPARKLE","SOMER","SHEBA","SHAYNE",
|
|
||||||
"SHARICE","SHANEL","SHALON","SAGE","ROY","ROSIO","ROSELIA","RENAY","REMA","REENA","PORSCHE","PING","PEG","OZIE","ORETHA","ORALEE",
|
|
||||||
"ODA","NU","NGAN","NAKESHA","MILLY","MARYBELLE","MARLIN","MARIS","MARGRETT","MARAGARET","MANIE","LURLENE","LILLIA","LIESELOTTE",
|
|
||||||
"LAVELLE","LASHAUNDA","LAKEESHA","KEITH","KAYCEE","KALYN","JOYA","JOETTE","JENAE","JANIECE","ILLA","GRISEL","GLAYDS","GENEVIE",
|
|
||||||
"GALA","FREDDA","FRED","ELMER","ELEONOR","DEBERA","DEANDREA","DAN","CORRINNE","CORDIA","CONTESSA","COLENE","CLEOTILDE","CHARLOTT",
|
|
||||||
"CHANTAY","CECILLE","BEATRIS","AZALEE","ARLEAN","ARDATH","ANJELICA","ANJA","ALFREDIA","ALEISHA","ADAM","ZADA","YUONNE","XIAO",
|
|
||||||
"WILLODEAN","WHITLEY","VENNIE","VANNA","TYISHA","TOVA","TORIE","TONISHA","TILDA","TIEN","TEMPLE","SIRENA","SHERRIL","SHANTI",
|
|
||||||
"SHAN","SENAIDA","SAMELLA","ROBBYN","RENDA","REITA","PHEBE","PAULITA","NOBUKO","NGUYET","NEOMI","MOON","MIKAELA","MELANIA",
|
|
||||||
"MAXIMINA","MARG","MAISIE","LYNNA","LILLI","LAYNE","LASHAUN","LAKENYA","LAEL","KIRSTIE","KATHLINE","KASHA","KARLYN","KARIMA",
|
|
||||||
"JOVAN","JOSEFINE","JENNELL","JACQUI","JACKELYN","HYO","HIEN","GRAZYNA","FLORRIE","FLORIA","ELEONORA","DWANA","DORLA","DONG",
|
|
||||||
"DELMY","DEJA","DEDE","DANN","CRYSTA","CLELIA","CLARIS","CLARENCE","CHIEKO","CHERLYN","CHERELLE","CHARMAIN","CHARA","CAMMY","BEE",
|
|
||||||
"ARNETTE","ARDELLE","ANNIKA","AMIEE","AMEE","ALLENA","YVONE","YUKI","YOSHIE","YEVETTE","YAEL","WILLETTA","VONCILE","VENETTA",
|
|
||||||
"TULA","TONETTE","TIMIKA","TEMIKA","TELMA","TEISHA","TAREN","TA","STACEE","SHIN","SHAWNTA","SATURNINA","RICARDA","POK","PASTY",
|
|
||||||
"ONIE","NUBIA","MORA","MIKE","MARIELLE","MARIELLA","MARIANELA","MARDELL","MANY","LUANNA","LOISE","LISABETH","LINDSY","LILLIANA",
|
|
||||||
"LILLIAM","LELAH","LEIGHA","LEANORA","LANG","KRISTEEN","KHALILAH","KEELEY","KANDRA","JUNKO","JOAQUINA","JERLENE","JANI","JAMIKA",
|
|
||||||
"JAME","HSIU","HERMILA","GOLDEN","GENEVIVE","EVIA","EUGENA","EMMALINE","ELFREDA","ELENE","DONETTE","DELCIE","DEEANNA","DARCEY",
|
|
||||||
"CUC","CLARINDA","CIRA","CHAE","CELINDA","CATHERYN","CATHERIN","CASIMIRA","CARMELIA","CAMELLIA","BREANA","BOBETTE","BERNARDINA",
|
|
||||||
"BEBE","BASILIA","ARLYNE","AMAL","ALAYNA","ZONIA","ZENIA","YURIKO","YAEKO","WYNELL","WILLOW","WILLENA","VERNIA","TU","TRAVIS",
|
|
||||||
"TORA","TERRILYN","TERICA","TENESHA","TAWNA","TAJUANA","TAINA","STEPHNIE","SONA","SOL","SINA","SHONDRA","SHIZUKO","SHERLENE",
|
|
||||||
"SHERICE","SHARIKA","ROSSIE","ROSENA","RORY","RIMA","RIA","RHEBA","RENNA","PETER","NATALYA","NANCEE","MELODI","MEDA","MAXIMA",
|
|
||||||
"MATHA","MARKETTA","MARICRUZ","MARCELENE","MALVINA","LUBA","LOUETTA","LEIDA","LECIA","LAURAN","LASHAWNA","LAINE","KHADIJAH",
|
|
||||||
"KATERINE","KASI","KALLIE","JULIETTA","JESUSITA","JESTINE","JESSIA","JEREMY","JEFFIE","JANYCE","ISADORA","GEORGIANNE","FIDELIA",
|
|
||||||
"EVITA","EURA","EULAH","ESTEFANA","ELSY","ELIZABET","ELADIA","DODIE","DION","DIA","DENISSE","DELORAS","DELILA","DAYSI","DAKOTA",
|
|
||||||
"CURTIS","CRYSTLE","CONCHA","COLBY","CLARETTA","CHU","CHRISTIA","CHARLSIE","CHARLENA","CARYLON","BETTYANN","ASLEY","ASHLEA",
|
|
||||||
"AMIRA","AI","AGUEDA","AGNUS","YUETTE","VINITA","VICTORINA","TYNISHA","TREENA","TOCCARA","TISH","THOMASENA","TEGAN","SOILA",
|
|
||||||
"SHILOH","SHENNA","SHARMAINE","SHANTAE","SHANDI","SEPTEMBER","SARAN","SARAI","SANA","SAMUEL","SALLEY","ROSETTE","ROLANDE","REGINE",
|
|
||||||
"OTELIA","OSCAR","OLEVIA","NICHOLLE","NECOLE","NAIDA","MYRTA","MYESHA","MITSUE","MINTA","MERTIE","MARGY","MAHALIA","MADALENE",
|
|
||||||
"LOVE","LOURA","LOREAN","LEWIS","LESHA","LEONIDA","LENITA","LAVONE","LASHELL","LASHANDRA","LAMONICA","KIMBRA","KATHERINA","KARRY",
|
|
||||||
"KANESHA","JULIO","JONG","JENEVA","JAQUELYN","HWA","GILMA","GHISLAINE","GERTRUDIS","FRANSISCA","FERMINA","ETTIE","ETSUKO","ELLIS",
|
|
||||||
"ELLAN","ELIDIA","EDRA","DORETHEA","DOREATHA","DENYSE","DENNY","DEETTA","DAINE","CYRSTAL","CORRIN","CAYLA","CARLITA","CAMILA",
|
|
||||||
"BURMA","BULA","BUENA","BLAKE","BARABARA","AVRIL","AUSTIN","ALAINE","ZANA","WILHEMINA","WANETTA","VIRGIL","VI","VERONIKA","VERNON",
|
|
||||||
"VERLINE","VASILIKI","TONITA","TISA","TEOFILA","TAYNA","TAUNYA","TANDRA","TAKAKO","SUNNI","SUANNE","SIXTA","SHARELL","SEEMA",
|
|
||||||
"RUSSELL","ROSENDA","ROBENA","RAYMONDE","PEI","PAMILA","OZELL","NEIDA","NEELY","MISTIE","MICHA","MERISSA","MAURITA","MARYLN",
|
|
||||||
"MARYETTA","MARSHALL","MARCELL","MALENA","MAKEDA","MADDIE","LOVETTA","LOURIE","LORRINE","LORILEE","LESTER","LAURENA","LASHAY",
|
|
||||||
"LARRAINE","LAREE","LACRESHA","KRISTLE","KRISHNA","KEVA","KEIRA","KAROLE","JOIE","JINNY","JEANNETTA","JAMA","HEIDY","GILBERTE",
|
|
||||||
"GEMA","FAVIOLA","EVELYNN","ENDA","ELLI","ELLENA","DIVINA","DAGNY","COLLENE","CODI","CINDIE","CHASSIDY","CHASIDY","CATRICE",
|
|
||||||
"CATHERINA","CASSEY","CAROLL","CARLENA","CANDRA","CALISTA","BRYANNA","BRITTENY","BEULA","BARI","AUDRIE","AUDRIA","ARDELIA",
|
|
||||||
"ANNELLE","ANGILA","ALONA","ALLYN","DOUGLAS","ROGER","JONATHAN","RALPH","NICHOLAS","BENJAMIN","BRUCE","HARRY","WAYNE","STEVE",
|
|
||||||
"HOWARD","ERNEST","PHILLIP","TODD","CRAIG","ALAN","PHILIP","EARL","DANNY","BRYAN","STANLEY","LEONARD","NATHAN","MANUEL","RODNEY",
|
|
||||||
"MARVIN","VINCENT","JEFFERY","JEFF","CHAD","JACOB","ALFRED","BRADLEY","HERBERT","FREDERICK","EDWIN","DON","RICKY","RANDALL",
|
|
||||||
"BARRY","BERNARD","LEROY","MARCUS","THEODORE","CLIFFORD","MIGUEL","JIM","TOM","CALVIN","BILL","LLOYD","DEREK","WARREN","DARRELL",
|
|
||||||
"JEROME","FLOYD","ALVIN","TIM","GORDON","GREG","JORGE","DUSTIN","PEDRO","DERRICK","ZACHARY","HERMAN","GLEN","HECTOR","RICARDO",
|
|
||||||
"RICK","BRENT","RAMON","GILBERT","MARC","REGINALD","RUBEN","NATHANIEL","RAFAEL","EDGAR","MILTON","RAUL","BEN","CHESTER","DUANE",
|
|
||||||
"FRANKLIN","BRAD","RON","ROLAND","ARNOLD","HARVEY","JARED","ERIK","DARRYL","NEIL","JAVIER","FERNANDO","CLINTON","TED","MATHEW",
|
|
||||||
"TYRONE","DARREN","LANCE","KURT","ALLAN","NELSON","GUY","CLAYTON","HUGH","MAX","DWAYNE","DWIGHT","ARMANDO","FELIX","EVERETT",
|
|
||||||
"IAN","WALLACE","KEN","BOB","ALFREDO","ALBERTO","DAVE","IVAN","BYRON","ISAAC","MORRIS","CLIFTON","WILLARD","ROSS","ANDY",
|
|
||||||
"SALVADOR","KIRK","SERGIO","SETH","KENT","TERRANCE","EDUARDO","TERRENCE","ENRIQUE","WADE","STUART","FREDRICK","ARTURO","ALEJANDRO",
|
|
||||||
"NICK","LUTHER","WENDELL","JEREMIAH","JULIUS","OTIS","TREVOR","OLIVER","LUKE","HOMER","GERARD","DOUG","KENNY","HUBERT","LYLE",
|
|
||||||
"MATT","ALFONSO","ORLANDO","REX","CARLTON","ERNESTO","NEAL","PABLO","LORENZO","OMAR","WILBUR","GRANT","HORACE","RODERICK",
|
|
||||||
"ABRAHAM","WILLIS","RICKEY","ANDRES","CESAR","JOHNATHAN","MALCOLM","RUDOLPH","DAMON","KELVIN","PRESTON","ALTON","ARCHIE","MARCO",
|
|
||||||
"WM","PETE","RANDOLPH","GARRY","GEOFFREY","JONATHON","FELIPE","GERARDO","ED","DOMINIC","DELBERT","COLIN","GUILLERMO","EARNEST",
|
|
||||||
"LUCAS","BENNY","SPENCER","RODOLFO","MYRON","EDMUND","GARRETT","SALVATORE","CEDRIC","LOWELL","GREGG","SHERMAN","WILSON",
|
|
||||||
"SYLVESTER","ROOSEVELT","ISRAEL","JERMAINE","FORREST","WILBERT","LELAND","SIMON","CLARK","IRVING","BRYANT","OWEN","RUFUS",
|
|
||||||
"WOODROW","KRISTOPHER","MACK","LEVI","MARCOS","GUSTAVO","JAKE","LIONEL","GILBERTO","CLINT","NICOLAS","ISMAEL","ORVILLE","ERVIN",
|
|
||||||
"DEWEY","AL","WILFRED","JOSH","HUGO","IGNACIO","CALEB","TOMAS","SHELDON","ERICK","STEWART","DOYLE","DARREL","ROGELIO","TERENCE",
|
|
||||||
"SANTIAGO","ALONZO","ELIAS","BERT","ELBERT","RAMIRO","CONRAD","NOAH","GRADY","PHIL","CORNELIUS","LAMAR","ROLANDO","CLAY","PERCY",
|
|
||||||
"DEXTER","BRADFORD","DARIN","AMOS","MOSES","IRVIN","SAUL","ROMAN","RANDAL","TIMMY","DARRIN","WINSTON","BRENDAN","ABEL","DOMINICK",
|
|
||||||
"BOYD","EMILIO","ELIJAH","DOMINGO","EMMETT","MARLON","EMANUEL","JERALD","EDMOND","EMIL","DEWAYNE","WILL","OTTO","TEDDY",
|
|
||||||
"REYNALDO","BRET","JESS","TRENT","HUMBERTO","EMMANUEL","STEPHAN","VICENTE","LAMONT","GARLAND","MILES","EFRAIN","HEATH","RODGER",
|
|
||||||
"HARLEY","ETHAN","ELDON","ROCKY","PIERRE","JUNIOR","FREDDY","ELI","BRYCE","ANTOINE","STERLING","CHASE","GROVER","ELTON",
|
|
||||||
"CLEVELAND","DYLAN","CHUCK","DAMIAN","REUBEN","STAN","AUGUST","LEONARDO","JASPER","RUSSEL","ERWIN","BENITO","HANS","MONTE",
|
|
||||||
"BLAINE","ERNIE","CURT","QUENTIN","AGUSTIN","MURRAY","JAMAL","ADOLFO","HARRISON","TYSON","BURTON","BRADY","ELLIOTT","WILFREDO",
|
|
||||||
"BART","JARROD","VANCE","DENIS","DAMIEN","JOAQUIN","HARLAN","DESMOND","ELLIOT","DARWIN","GREGORIO","BUDDY","XAVIER","KERMIT",
|
|
||||||
"ROSCOE","ESTEBAN","ANTON","SOLOMON","SCOTTY","NORBERT","ELVIN","WILLIAMS","NOLAN","ROD","QUINTON","HAL","BRAIN","ROB","ELWOOD",
|
|
||||||
"KENDRICK","DARIUS","MOISES","FIDEL","THADDEUS","CLIFF","MARCEL","JACKSON","RAPHAEL","BRYON","ARMAND","ALVARO","JEFFRY","DANE",
|
|
||||||
"JOESPH","THURMAN","NED","RUSTY","MONTY","FABIAN","REGGIE","MASON","GRAHAM","ISAIAH","VAUGHN","GUS","LOYD","DIEGO","ADOLPH",
|
|
||||||
"NORRIS","MILLARD","ROCCO","GONZALO","DERICK","RODRIGO","WILEY","RIGOBERTO","ALPHONSO","TY","NOE","VERN","REED","JEFFERSON",
|
|
||||||
"ELVIS","BERNARDO","MAURICIO","HIRAM","DONOVAN","BASIL","RILEY","NICKOLAS","MAYNARD","SCOT","VINCE","QUINCY","EDDY","SEBASTIAN",
|
|
||||||
"FEDERICO","ULYSSES","HERIBERTO","DONNELL","COLE","DAVIS","GAVIN","EMERY","WARD","ROMEO","JAYSON","DANTE","CLEMENT","COY",
|
|
||||||
"MAXWELL","JARVIS","BRUNO","ISSAC","DUDLEY","BROCK","SANFORD","CARMELO","BARNEY","NESTOR","STEFAN","DONNY","ART","LINWOOD","BEAU",
|
|
||||||
"WELDON","GALEN","ISIDRO","TRUMAN","DELMAR","JOHNATHON","SILAS","FREDERIC","DICK","IRWIN","MERLIN","CHARLEY","MARCELINO","HARRIS",
|
|
||||||
"CARLO","TRENTON","KURTIS","HUNTER","AURELIO","WINFRED","VITO","COLLIN","DENVER","CARTER","LEONEL","EMORY","PASQUALE","MOHAMMAD",
|
|
||||||
"MARIANO","DANIAL","LANDON","DIRK","BRANDEN","ADAN","BUFORD","GERMAN","WILMER","EMERSON","ZACHERY","FLETCHER","JACQUES","ERROL",
|
|
||||||
"DALTON","MONROE","JOSUE","EDWARDO","BOOKER","WILFORD","SONNY","SHELTON","CARSON","THERON","RAYMUNDO","DAREN","HOUSTON","ROBBY",
|
|
||||||
"LINCOLN","GENARO","BENNETT","OCTAVIO","CORNELL","HUNG","ARRON","ANTONY","HERSCHEL","GIOVANNI","GARTH","CYRUS","CYRIL","RONNY",
|
|
||||||
"LON","FREEMAN","DUNCAN","KENNITH","CARMINE","ERICH","CHADWICK","WILBURN","RUSS","REID","MYLES","ANDERSON","MORTON","JONAS",
|
|
||||||
"FOREST","MITCHEL","MERVIN","ZANE","RICH","JAMEL","LAZARO","ALPHONSE","RANDELL","MAJOR","JARRETT","BROOKS","ABDUL","LUCIANO",
|
|
||||||
"SEYMOUR","EUGENIO","MOHAMMED","VALENTIN","CHANCE","ARNULFO","LUCIEN","FERDINAND","THAD","EZRA","ALDO","RUBIN","ROYAL","MITCH",
|
|
||||||
"EARLE","ABE","WYATT","MARQUIS","LANNY","KAREEM","JAMAR","BORIS","ISIAH","EMILE","ELMO","ARON","LEOPOLDO","EVERETTE","JOSEF",
|
|
||||||
"ELOY","RODRICK","REINALDO","LUCIO","JERROD","WESTON","HERSHEL","BARTON","PARKER","LEMUEL","BURT","JULES","GIL","ELISEO","AHMAD",
|
|
||||||
"NIGEL","EFREN","ANTWAN","ALDEN","MARGARITO","COLEMAN","DINO","OSVALDO","LES","DEANDRE","NORMAND","KIETH","TREY","NORBERTO",
|
|
||||||
"NAPOLEON","JEROLD","FRITZ","ROSENDO","MILFORD","CHRISTOPER","ALFONZO","LYMAN","JOSIAH","BRANT","WILTON","RICO","JAMAAL","DEWITT",
|
|
||||||
"BRENTON","OLIN","FOSTER","FAUSTINO","CLAUDIO","JUDSON","GINO","EDGARDO","ALEC","TANNER","JARRED","DONN","TAD","PRINCE","PORFIRIO",
|
|
||||||
"ODIS","LENARD","CHAUNCEY","TOD","MEL","MARCELO","KORY","AUGUSTUS","KEVEN","HILARIO","BUD","SAL","ORVAL","MAURO","ZACHARIAH",
|
|
||||||
"OLEN","ANIBAL","MILO","JED","DILLON","AMADO","NEWTON","LENNY","RICHIE","HORACIO","BRICE","MOHAMED","DELMER","DARIO","REYES","MAC",
|
|
||||||
"JONAH","JERROLD","ROBT","HANK","RUPERT","ROLLAND","KENTON","DAMION","ANTONE","WALDO","FREDRIC","BRADLY","KIP","BURL","WALKER",
|
|
||||||
"TYREE","JEFFEREY","AHMED","WILLY","STANFORD","OREN","NOBLE","MOSHE","MIKEL","ENOCH","BRENDON","QUINTIN","JAMISON","FLORENCIO",
|
|
||||||
"DARRICK","TOBIAS","HASSAN","GIUSEPPE","DEMARCUS","CLETUS","TYRELL","LYNDON","KEENAN","WERNER","GERALDO","COLUMBUS","CHET",
|
|
||||||
"BERTRAM","MARKUS","HUEY","HILTON","DWAIN","DONTE","TYRON","OMER","ISAIAS","HIPOLITO","FERMIN","ADALBERTO","BO","BARRETT",
|
|
||||||
"TEODORO","MCKINLEY","MAXIMO","GARFIELD","RALEIGH","LAWERENCE","ABRAM","RASHAD","KING","EMMITT","DARON","SAMUAL","MIQUEL",
|
|
||||||
"EUSEBIO","DOMENIC","DARRON","BUSTER","WILBER","RENATO","JC","HOYT","HAYWOOD","EZEKIEL","CHAS","FLORENTINO","ELROY","CLEMENTE",
|
|
||||||
"ARDEN","NEVILLE","EDISON","DESHAWN","NATHANIAL","JORDON","DANILO","CLAUD","SHERWOOD","RAYMON","RAYFORD","CRISTOBAL","AMBROSE",
|
|
||||||
"TITUS","HYMAN","FELTON","EZEQUIEL","ERASMO","STANTON","LONNY","LEN","IKE","MILAN","LINO","JAROD","HERB","ANDREAS","WALTON",
|
|
||||||
"RHETT","PALMER","DOUGLASS","CORDELL","OSWALDO","ELLSWORTH","VIRGILIO","TONEY","NATHANAEL","DEL","BENEDICT","MOSE","JOHNSON",
|
|
||||||
"ISREAL","GARRET","FAUSTO","ASA","ARLEN","ZACK","WARNER","MODESTO","FRANCESCO","MANUAL","GAYLORD","GASTON","FILIBERTO","DEANGELO",
|
|
||||||
"MICHALE","GRANVILLE","WES","MALIK","ZACKARY","TUAN","ELDRIDGE","CRISTOPHER","CORTEZ","ANTIONE","MALCOM","LONG","KOREY","JOSPEH",
|
|
||||||
"COLTON","WAYLON","VON","HOSEA","SHAD","SANTO","RUDOLF","ROLF","REY","RENALDO","MARCELLUS","LUCIUS","KRISTOFER","BOYCE","BENTON",
|
|
||||||
"HAYDEN","HARLAND","ARNOLDO","RUEBEN","LEANDRO","KRAIG","JERRELL","JEROMY","HOBERT","CEDRICK","ARLIE","WINFORD","WALLY","LUIGI",
|
|
||||||
"KENETH","JACINTO","GRAIG","FRANKLYN","EDMUNDO","SID","PORTER","LEIF","JERAMY","BUCK","WILLIAN","VINCENZO","SHON","LYNWOOD","JERE",
|
|
||||||
"HAI","ELDEN","DORSEY","DARELL","BRODERICK","ALONSO"]
|
|
||||||
|
|
||||||
def Problem22():
|
|
||||||
#Setup the variables
|
|
||||||
sums = [] #Holds the score based on the sum of the characters in the name
|
|
||||||
prod = [] #Holds the score based on the sum of the characters and the location in alphabetical order
|
|
||||||
|
|
||||||
#Sort all the names
|
|
||||||
__NAMES.sort()
|
|
||||||
#Step through every name adding up the values of the characters
|
|
||||||
for nameCnt in range(0, len(__NAMES)):
|
|
||||||
#Step through every character in the current name adding up the value of the characters
|
|
||||||
sums.append(0)
|
|
||||||
for charCnt in range(0, len(__NAMES[nameCnt])):
|
|
||||||
#A = 65 so subtracting 64 means A - 1. This will only work correctly if all letters are capitalized
|
|
||||||
sums[nameCnt] += (ord(__NAMES[nameCnt][charCnt]) - 64)
|
|
||||||
|
|
||||||
#Get the product for all numbers
|
|
||||||
for cnt in range(0, len(sums)):
|
|
||||||
prod.append(sums[cnt] * (cnt + 1))
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The answer to the question is " + str(sum(prod)))
|
|
||||||
|
|
||||||
|
|
||||||
#This ensures the correct function is called if this is called as a stand along script
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch()
|
|
||||||
timer.start()
|
|
||||||
Problem22()
|
|
||||||
timer.stop()
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
""" Results:
|
|
||||||
The answer to the question is 871198282
|
|
||||||
It took 9.206 milliseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
87
Problem23.py
87
Problem23.py
@@ -1,87 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem23.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 03-22-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers
|
|
||||||
#All of my imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
import Algorithms
|
|
||||||
|
|
||||||
__maxNum = 28123
|
|
||||||
|
|
||||||
|
|
||||||
#A function that returns true if num can be created by adding two elements from abund and false if it cannot
|
|
||||||
def isSum(abund: list, num: int) -> bool:
|
|
||||||
sumOfNums = 0
|
|
||||||
#Pick a number for the first part of the sum
|
|
||||||
for firstNum in range(0, len(abund)):
|
|
||||||
#Pick a number for the second part of the sum
|
|
||||||
for secondNum in range(0, len(abund)):
|
|
||||||
sumOfNums = abund[firstNum] + abund[secondNum]
|
|
||||||
if(sumOfNums == num):
|
|
||||||
return True
|
|
||||||
elif(sumOfNums > num):
|
|
||||||
break
|
|
||||||
#If you have run through the entire list and did not find a sum then it is false
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def Problem23():
|
|
||||||
#Setup the variables
|
|
||||||
divisorSums = []
|
|
||||||
#Make sure every element has a 0 in it's location
|
|
||||||
for cnt in range(0, __maxNum):
|
|
||||||
divisorSums.append(0)
|
|
||||||
|
|
||||||
#Get the sum of the divisors of all numbers < __maxNum
|
|
||||||
for cnt in range(1, __maxNum):
|
|
||||||
div = Algorithms.getDivisors(cnt)
|
|
||||||
if(len(div) > 1):
|
|
||||||
div.remove(div[len(div) - 1])
|
|
||||||
divisorSums[cnt] = sum(div)
|
|
||||||
|
|
||||||
#Get the abundant numbers
|
|
||||||
abund = []
|
|
||||||
for cnt in range(0, len(divisorSums)):
|
|
||||||
if(divisorSums[cnt] > cnt):
|
|
||||||
abund.append(cnt)
|
|
||||||
|
|
||||||
#Check if each number can be the sum of 2 abundant numbers and add to the sum if no
|
|
||||||
sumOfNums = 0
|
|
||||||
for cnt in range(1, __maxNum):
|
|
||||||
if(not isSum(abund, cnt)):
|
|
||||||
sumOfNums += cnt
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The answer is " + str(sumOfNums))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch()
|
|
||||||
timer.start()
|
|
||||||
Problem23()
|
|
||||||
timer.stop()
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
""" Results:
|
|
||||||
The answer is 4179871
|
|
||||||
It took 27.738 minutes to run this algorithm
|
|
||||||
"""
|
|
||||||
53
Problem24.py
53
Problem24.py
@@ -1,53 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem24.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 03-24-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
import Algorithms
|
|
||||||
|
|
||||||
__neededPerm = 1000000 #The number of the permutation that you need
|
|
||||||
|
|
||||||
|
|
||||||
def Problem24():
|
|
||||||
#Setup the variables
|
|
||||||
nums = "0123456789"
|
|
||||||
|
|
||||||
#Get all permutations of the string
|
|
||||||
permutations = Algorithms.getPermutations(nums)
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The 1 millionth permutation is " + str(permutations[__neededPerm - 1]))
|
|
||||||
|
|
||||||
|
|
||||||
#This calls the appropriate functions if the script is called stand alone
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch()
|
|
||||||
timer.start()
|
|
||||||
Problem24()
|
|
||||||
timer.stop()
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
""" Results:
|
|
||||||
The 1 millionth permutation is 2783915460
|
|
||||||
It took 7.363 seconds to run this algorithm
|
|
||||||
"""
|
|
||||||
84
Problem26.py
84
Problem26.py
@@ -1,84 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem26.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 07-29-19
|
|
||||||
#Modified: 08-02-19
|
|
||||||
#Find the value of d < 1000 for which 1/d contains the longest recurring cycle in its decimal fraction part.
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
import Algorithms
|
|
||||||
|
|
||||||
|
|
||||||
__topNumber = 999 #The largest denominator to be checked
|
|
||||||
|
|
||||||
|
|
||||||
def Problem26():
|
|
||||||
longestCycle = 0
|
|
||||||
longestNumber = 1
|
|
||||||
#Start with 1/2 and find out how long the longest cycle is by checking the remainders
|
|
||||||
#Loop through every number from 2-999 and use it for the denominator
|
|
||||||
for denominator in range(2, __topNumber):
|
|
||||||
remainderList = [] #Holds the list of remainders
|
|
||||||
endFound = False #Holds whether we have found an end to the number (either a cycle or a 0 for remainder)
|
|
||||||
cycleFound = False #Holds whether a cycle was detected
|
|
||||||
numerator = 1 #The numerator that will be divided
|
|
||||||
while(not endFound):
|
|
||||||
#Get the remainder after the division
|
|
||||||
remainder = numerator % denominator
|
|
||||||
#Check if the remainder is 0
|
|
||||||
#If it is 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
|
|
||||||
elif remainder in remainderList:
|
|
||||||
endFound = True
|
|
||||||
cycleFound = True
|
|
||||||
#Else add it to the list
|
|
||||||
else:
|
|
||||||
remainderList.append(remainder)
|
|
||||||
|
|
||||||
#Multiply the remainder by 10 to continue finding the next remainder
|
|
||||||
numerator = remainder * 10
|
|
||||||
#If a cycle was found check the size of the list against the largest cycle
|
|
||||||
if(cycleFound):
|
|
||||||
#If it is larger than the largest, set it as the new largest
|
|
||||||
if(len(remainderList) > longestCycle):
|
|
||||||
longestCycle = len(remainderList)
|
|
||||||
longestNumber = denominator
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The longest cycle is " + str(longestCycle) + " digits long")
|
|
||||||
print("It is started with the number " + str(longestNumber))
|
|
||||||
|
|
||||||
|
|
||||||
#This calls the appropriate functions if the script is called stand along
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch()
|
|
||||||
timer.start()
|
|
||||||
Problem26()
|
|
||||||
timer.stop()
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
""" Results:
|
|
||||||
The longest cycle is 982 digits long
|
|
||||||
It is started with the number 983
|
|
||||||
It took 182.704 milliseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
71
Problem27.py
71
Problem27.py
@@ -1,71 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem27.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 09-15-19
|
|
||||||
#Modified: 09-15-19
|
|
||||||
#Find the product of the coefficients, |a| < 1000 and |b| <= 1000, for the quadratic expression that produces the maximum number of primes for consecutive values of n, starting with n=0.
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
import Algorithms
|
|
||||||
|
|
||||||
|
|
||||||
def Problem27():
|
|
||||||
#Setup the variables
|
|
||||||
topA = 0 #The A for the most n's generated
|
|
||||||
topB = 0 #The B for the most n's generated
|
|
||||||
topN = 0 #The most n's generated
|
|
||||||
primes = Algorithms.getPrimes(12000) #A list of all primes that could possibly be generated with this formula
|
|
||||||
|
|
||||||
#Start with the lowest possible A and check all possibilities after that
|
|
||||||
for a in range(-999, 999):
|
|
||||||
#Start with the lowest possible B and check all possibilities after that
|
|
||||||
for b in range(-1000, 1000):
|
|
||||||
#Start with n=0 and check the formula to see how many primes you can get get with concecutive n's
|
|
||||||
n = 0
|
|
||||||
quadratic = (n * n) + (a * n) + b
|
|
||||||
while(quadratic in primes):
|
|
||||||
n += 1
|
|
||||||
quadratic = (n * n) + (a * n) + b
|
|
||||||
n -= 1 #Negate an n because the last formula failed
|
|
||||||
|
|
||||||
#Set all the largest numbers if this created more primes than any other
|
|
||||||
if(n > topN):
|
|
||||||
topN = n
|
|
||||||
topB = b
|
|
||||||
topA = a
|
|
||||||
print("The greatest number of primes found is " + str(topN))
|
|
||||||
print("It was found with A = " + str(topA) + ", B = " + str(topB))
|
|
||||||
print("The product of A and B is " + str(topA * topB))
|
|
||||||
|
|
||||||
|
|
||||||
#This calls the appropriate functions if the script is called stand alone
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch()
|
|
||||||
timer.start()
|
|
||||||
Problem27()
|
|
||||||
timer.stop()
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
""" Results:
|
|
||||||
The greatest number of primes found is 70
|
|
||||||
It was found with A = -61, B = 971
|
|
||||||
The product of A and B is -59231
|
|
||||||
It took 35.775 seconds to run this algorithm
|
|
||||||
"""
|
|
||||||
109
Problem28.py
109
Problem28.py
@@ -1,109 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem28.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 09-22-19
|
|
||||||
#Modified: 09-22-19
|
|
||||||
#What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed by starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
|
|
||||||
|
|
||||||
def setupGrid() -> list:
|
|
||||||
#Setup the grid to be the right size and fill it with 0's
|
|
||||||
grid = [[0 for x in range(1001)] for y in range(1001)]
|
|
||||||
|
|
||||||
finalLocation = False #A flag to indicate if the final location to be filled has been reached
|
|
||||||
currentNum = 1 #Set the number that is going to be put at each location
|
|
||||||
#Start with the middle location and set it correctly and advance the tracker to the next number
|
|
||||||
xLocation = 500
|
|
||||||
yLocation = 500
|
|
||||||
grid[yLocation][xLocation] = currentNum
|
|
||||||
currentNum += 1
|
|
||||||
#Move right the first time
|
|
||||||
xLocation += 1
|
|
||||||
#Move in a circular pattern until you reach the final location
|
|
||||||
while(not finalLocation):
|
|
||||||
#Move down until you reach a blank location on the left
|
|
||||||
while(grid[yLocation][xLocation - 1] != 0):
|
|
||||||
grid[yLocation][xLocation] = currentNum
|
|
||||||
currentNum += 1
|
|
||||||
yLocation += 1
|
|
||||||
|
|
||||||
#Move left until you reach a blank location above
|
|
||||||
while(grid[yLocation - 1][xLocation] != 0):
|
|
||||||
grid[yLocation][xLocation] = currentNum
|
|
||||||
currentNum += 1
|
|
||||||
xLocation -= 1
|
|
||||||
|
|
||||||
#Move up until you reach a blank location to the right
|
|
||||||
while(grid[yLocation][xLocation + 1] != 0):
|
|
||||||
grid[yLocation][xLocation] = currentNum
|
|
||||||
currentNum += 1
|
|
||||||
yLocation -= 1
|
|
||||||
|
|
||||||
#Move right until you reach a blank location below
|
|
||||||
while(grid[yLocation + 1][xLocation] != 0):
|
|
||||||
grid[yLocation][xLocation] = currentNum
|
|
||||||
currentNum += 1
|
|
||||||
xLocation += 1
|
|
||||||
#Check if you are at the final location and break the loop if you are
|
|
||||||
if(xLocation == len(grid)):
|
|
||||||
finalLocation = True
|
|
||||||
break
|
|
||||||
return grid
|
|
||||||
|
|
||||||
def findSum(grid: list) -> int:
|
|
||||||
sumOfDiagonals = 0
|
|
||||||
leftSide = 0
|
|
||||||
rightSide = len(grid) - 1
|
|
||||||
row = 0
|
|
||||||
while(row < len(grid)):
|
|
||||||
#This ensure the middle location is only counted once
|
|
||||||
if(leftSide == rightSide):
|
|
||||||
sumOfDiagonals += grid[row][leftSide]
|
|
||||||
else:
|
|
||||||
sumOfDiagonals += grid[row][leftSide]
|
|
||||||
sumOfDiagonals += grid[row][rightSide]
|
|
||||||
row += 1
|
|
||||||
leftSide += 1
|
|
||||||
rightSide -= 1
|
|
||||||
return sumOfDiagonals
|
|
||||||
|
|
||||||
def Problem28():
|
|
||||||
#Setup the grid
|
|
||||||
grid = setupGrid()
|
|
||||||
#Find the sum of the diagonals in the grid
|
|
||||||
diagSum = findSum(grid)
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The sum of the diagonals in the given grid is " + str(diagSum))
|
|
||||||
|
|
||||||
#This calls the appropriate functions if the script is called stand alone
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch()
|
|
||||||
timer.start()
|
|
||||||
Problem28()
|
|
||||||
timer.stop()
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
""" Results:
|
|
||||||
The sum of the diagonals in the given grid is 669171001
|
|
||||||
It took 197.764 milliseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
62
Problem29.py
62
Problem29.py
@@ -1,62 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem29.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 10-10-19
|
|
||||||
#Modified: 10-10-19
|
|
||||||
#How many distinct terms are in the sequence generated by a^b for 2 <= a <= 100 and 2 <= b <= 100?
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
|
|
||||||
|
|
||||||
#Setup the variables
|
|
||||||
__BOTTOM_A = 2 #The lowest possible value for A
|
|
||||||
__TOP_A = 100 #The highest possible value for A
|
|
||||||
__BOTTOM_B = 2 #The lowest possible value for B
|
|
||||||
__TOP_B = 100 #The highest possible value for B
|
|
||||||
|
|
||||||
|
|
||||||
def Problem29():
|
|
||||||
unique = [] #This will hold all of the unique answers
|
|
||||||
|
|
||||||
#Start with the first A and move towards the top
|
|
||||||
for currentA in range(__BOTTOM_A, __TOP_A + 1):
|
|
||||||
#Start with the first B and move towards the top
|
|
||||||
for currentB in range(__BOTTOM_B, __TOP_B + 1):
|
|
||||||
#Get the new number
|
|
||||||
currentNum = currentA ** currentB
|
|
||||||
#If the new number isn't in the list add it
|
|
||||||
if currentNum not in unique:
|
|
||||||
unique.append(currentNum)
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The number of unique values generated by a^b for " + str(__BOTTOM_A) + " <= a < = " + str(__TOP_A) + " and " + str(__BOTTOM_B) + " <= b <= " + str(__TOP_B) + " is " + str(len(unique)))
|
|
||||||
|
|
||||||
#This calls the appropriate functions if the script is called stand alone
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch()
|
|
||||||
timer.start()
|
|
||||||
Problem29()
|
|
||||||
timer.stop()
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
""" Results:
|
|
||||||
The number of unique values generated by a^b for 2 <= a < = 100 and 2 <= b <= 100 is 9183
|
|
||||||
It took 304.630 milliseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
51
Problem3.py
51
Problem3.py
@@ -1,51 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem3.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 01-27-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#The largest prime factor of 600851475143
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
from Algorithms import getFactors
|
|
||||||
|
|
||||||
__targetNumber = 600851475143
|
|
||||||
|
|
||||||
|
|
||||||
def Problem3():
|
|
||||||
#Get the factors of the number
|
|
||||||
factors = getFactors(__targetNumber)
|
|
||||||
#The largest number will be the answer
|
|
||||||
#Print the results
|
|
||||||
print("The largest prime factor of " + str(__targetNumber) + " is " + str(factors[(len(factors) - 1)]))
|
|
||||||
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
|
||||||
if __name__ == '__main__':
|
|
||||||
timer = Stopwatch() #Used to determine the algorithm's run time
|
|
||||||
timer.start() #Start the timer
|
|
||||||
Problem3() #Call the function that answers the question
|
|
||||||
timer.stop() #Stop the timer
|
|
||||||
#Print the results of the timer
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
"""Results:
|
|
||||||
The largest prime factor of 600851475143 is 6857
|
|
||||||
It took 1.685 seconds to run this algorithm
|
|
||||||
"""
|
|
||||||
76
Problem30.py
76
Problem30.py
@@ -1,76 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem30.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 10-28-19
|
|
||||||
#Modified: 10-28-19
|
|
||||||
#Find the sum of all the numbers that can be written as the sum of the fifth powers of their digits.
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
|
|
||||||
|
|
||||||
#Setup the variables
|
|
||||||
__TOP_NUM = 1000000 #This is the largest number that will be checked
|
|
||||||
__BOTTOM_NUM = 2 #Starts with 2 because 0 and 1 don't count
|
|
||||||
__POWER_RAISED = 5 #This is the power that the digits are raised to
|
|
||||||
|
|
||||||
|
|
||||||
#Returns a list with the individual digits of the number passed to it
|
|
||||||
def getDigits(num: int) -> list:
|
|
||||||
listOfDigits = [] #This list holds the individual digits of num
|
|
||||||
#The easiest way to get the individual digits of a number is by converting it to a string
|
|
||||||
digits = str(num)
|
|
||||||
#Start with the first digit, convert it to an integer, store it in the list, and move to the next digit
|
|
||||||
for cnt in range(0, len(digits)):
|
|
||||||
listOfDigits.append(int(digits[cnt]))
|
|
||||||
#Return the list of digits
|
|
||||||
return listOfDigits
|
|
||||||
|
|
||||||
def Problem30():
|
|
||||||
sumOfFifthNumbers = [] #This is a list of the numbers that are the sum of the fifth power of their digits
|
|
||||||
|
|
||||||
#Start with the lowest number and increment until you reach the largest number
|
|
||||||
for currentNum in range(__BOTTOM_NUM, __TOP_NUM):
|
|
||||||
#Get the digits of the number
|
|
||||||
digits = getDigits(currentNum)
|
|
||||||
#Get the sum of the powers
|
|
||||||
sumOfPowers = 0
|
|
||||||
for cnt in range(0, len(digits)):
|
|
||||||
sumOfPowers += digits[cnt]**__POWER_RAISED
|
|
||||||
#Check if the sum of the powers is the same as the number
|
|
||||||
#If it is add it to the list, otherwise continue to the next number
|
|
||||||
if(sumOfPowers == currentNum):
|
|
||||||
sumOfFifthNumbers.append(currentNum)
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The sum of all the numbers that can be written as the sum of the fifth powers of their digits is " + str(sum(sumOfFifthNumbers)))
|
|
||||||
|
|
||||||
|
|
||||||
#This calls the appropriate functions if the script is called stand alone
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch()
|
|
||||||
timer.start()
|
|
||||||
Problem30()
|
|
||||||
timer.stop()
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
""" Results:
|
|
||||||
The sum of all the numbers that can be written as the sum of the fifth powers of their digits is 443839
|
|
||||||
It took 3.284 seconds to run this algorithm
|
|
||||||
"""
|
|
||||||
57
Problem31.py
57
Problem31.py
@@ -1,57 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem31.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 06-19-20
|
|
||||||
#Modified: 06-19-20
|
|
||||||
#How many different ways can £2 be made using any number of coins?
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2020 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
|
|
||||||
|
|
||||||
#Setup the variables
|
|
||||||
__desiredValue = 200
|
|
||||||
|
|
||||||
def Problem31():
|
|
||||||
permutations = 0
|
|
||||||
#Start with 200p and remove the necessary coins with each loop
|
|
||||||
for pound2 in range(__desiredValue, -1, -200):
|
|
||||||
for pound1 in range(pound2, -1, -100):
|
|
||||||
for pence50 in range(pound1, -1, -50):
|
|
||||||
for pence20 in range(pence50, -1, -20):
|
|
||||||
for pence10 in range(pence20, -1, -10):
|
|
||||||
for pence5 in range(pence10, -1, -5):
|
|
||||||
for pence2 in range(pence5, -1, -2):
|
|
||||||
permutations += 1
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("There are " + str(permutations) + " ways to make 2 pounds with the given denominations of coins")
|
|
||||||
|
|
||||||
#This calls the appropriate functions if the script is called stand alone
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch()
|
|
||||||
timer.start()
|
|
||||||
Problem31()
|
|
||||||
timer.stop()
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
""" Results:
|
|
||||||
There are 73682 ways to make 2 pounds with the given denominations of coins
|
|
||||||
It took 2.653 milliseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
63
Problem4.py
63
Problem4.py
@@ -1,63 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem4.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 01-28-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#Find the largest palindrome made from the product of two 3-digit numbers
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
|
|
||||||
__lowestNum = 100
|
|
||||||
__highestNum = 1000
|
|
||||||
|
|
||||||
|
|
||||||
def Problem4():
|
|
||||||
#Setup the variables
|
|
||||||
palindromes = [] #Holds all of the palindromes
|
|
||||||
currentNum = 0 #Holds the product of the two numbers I am currently working on
|
|
||||||
|
|
||||||
#Loop through every number from __lowestNum to __highestNum twice and multiply every number together
|
|
||||||
for num1 in range(__lowestNum, __highestNum + 1):
|
|
||||||
for num2 in range(num1, __highestNum + 1): #You can start at num1 because 100 * 101 == 101 * 100
|
|
||||||
currentNum = num1 * num2
|
|
||||||
#If the number is a palindrome add it to the list of palindromes, otherwise ignore it
|
|
||||||
#Using strings makes it easier to determine a palindrome
|
|
||||||
if(str(currentNum) == str(currentNum)[::-1]):
|
|
||||||
palindromes.append(currentNum)
|
|
||||||
|
|
||||||
#Sort the palindromes so that the last element is the largest
|
|
||||||
palindromes.sort()
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The largest palindrome made from the product of two 3-digit numbers is " + str(palindromes[len(palindromes) - 1]))
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
|
||||||
if __name__ == '__main__':
|
|
||||||
timer = Stopwatch() #Determines the algorithm's run time
|
|
||||||
timer.start() #Start the timer
|
|
||||||
Problem4() #Call the function that answers the question
|
|
||||||
timer.stop() #Stop the timer
|
|
||||||
#Print the results of the timer
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
"""Results:
|
|
||||||
The largest palindrome made from the product of two 3-digit numbers is 906609
|
|
||||||
It took 177.314 milliseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
69
Problem5.py
69
Problem5.py
@@ -1,69 +0,0 @@
|
|||||||
#ProjectEulter/Python/Project5.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 01-28-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
|
|
||||||
__startNum = 1
|
|
||||||
__stopNum = 20
|
|
||||||
|
|
||||||
|
|
||||||
def Problem5():
|
|
||||||
#Setup the variables
|
|
||||||
numFound = False #Holds whether we have found the divisible number yet
|
|
||||||
#Start at 20 and loop through all numbers until you find one that works
|
|
||||||
#It must be at least 20 to be divisible by 20
|
|
||||||
num = 20 #Holds the number that you are currently checking against
|
|
||||||
while((not numFound) and (num > 0)): #Set an escape, just in case there is no answer and you overflow
|
|
||||||
#Set that you found the number to true, because you set this flag when you don't find it
|
|
||||||
numFound = True
|
|
||||||
#See if the current number is divisible by all numbers from 1 to 20
|
|
||||||
for divisor in range(__startNum, __stopNum + 1):
|
|
||||||
#If it is not set a flag to move to the next possible number
|
|
||||||
if((num % divisor) != 0):
|
|
||||||
numFound = False
|
|
||||||
break
|
|
||||||
|
|
||||||
#Increment the number by 2 to check the next one if you didn't find the number
|
|
||||||
if not numFound:
|
|
||||||
num += 2
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
if(num < 0):
|
|
||||||
print("There was an error: Could not find a number that fit the criteria")
|
|
||||||
else:
|
|
||||||
print("The smallest positive number that is evenly divisible by all numbers 1-20 is " + str(num))
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
|
||||||
if __name__ == '__main__':
|
|
||||||
timer = Stopwatch() #Determines the algorithm's run time
|
|
||||||
timer.start() #Start the timer
|
|
||||||
Problem5() #Call the function that answers the question
|
|
||||||
timer.stop() #Stop the timer
|
|
||||||
#Print the results of the timer
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
"""Results:
|
|
||||||
The smallest positive number that is evenly divisible by all numbers 1-20 is 232792560
|
|
||||||
It took 50.236 seconds to run this algorithm
|
|
||||||
"""
|
|
||||||
56
Problem6.py
56
Problem6.py
@@ -1,56 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem6.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 01-28-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch #To time the algorithm
|
|
||||||
|
|
||||||
|
|
||||||
def Problem6():
|
|
||||||
#Setup the variables
|
|
||||||
sumOfSquares = 0 #Holds the sum of the square of the numbers
|
|
||||||
squareOfSum = 0 #Holds the square of the sum of the numbers
|
|
||||||
|
|
||||||
#Run through all numbers from 1-100 and add them to the approriate sums
|
|
||||||
for num in range(1, 101):
|
|
||||||
sumOfSquares += num * num #Get the sum of the squares of the first 100 natural numbers
|
|
||||||
squareOfSum += num #Get the sum of the first 100 natural numbers so you can square it later
|
|
||||||
|
|
||||||
#Square the normal sum
|
|
||||||
squareOfSum *= squareOfSum
|
|
||||||
|
|
||||||
#Print the result
|
|
||||||
print("The difference between the sum of the squares and the square of the sum of the numbers 1-100 is " + str(abs(sumOfSquares - squareOfSum)))
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
|
||||||
if __name__ == '__main__':
|
|
||||||
timer = Stopwatch() #Determines the algorithm's run time
|
|
||||||
timer.start() #Start the timer
|
|
||||||
Problem6() #Call the function that answers the question
|
|
||||||
timer.stop() #Stop the timer
|
|
||||||
#Print the results of the timer
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
"""Results:
|
|
||||||
The difference between the sum of the squares and the square of the sum of the numbers 1-100 is 25164150
|
|
||||||
It took 24.384 microseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
309
Problem67.py
309
Problem67.py
@@ -1,309 +0,0 @@
|
|||||||
#ProjectEuler/Python/Problem67.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 03-26-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#Find the maximum total from top to bottom
|
|
||||||
"""
|
|
||||||
59
|
|
||||||
73 41
|
|
||||||
52 40 09
|
|
||||||
26 53 06 34
|
|
||||||
10 51 87 86 81
|
|
||||||
61 95 66 57 25 68
|
|
||||||
90 81 80 38 92 67 73
|
|
||||||
30 28 51 76 81 18 75 44
|
|
||||||
84 14 95 87 62 81 17 78 58
|
|
||||||
21 46 71 58 02 79 62 39 31 09
|
|
||||||
56 34 35 53 78 31 81 18 90 93 15
|
|
||||||
78 53 04 21 84 93 32 13 97 11 37 51
|
|
||||||
45 03 81 79 05 18 78 86 13 30 63 99 95
|
|
||||||
39 87 96 28 03 38 42 17 82 87 58 07 22 57
|
|
||||||
06 17 51 17 07 93 09 07 75 97 95 78 87 08 53
|
|
||||||
67 66 59 60 88 99 94 65 55 77 55 34 27 53 78 28
|
|
||||||
76 40 41 04 87 16 09 42 75 69 23 97 30 60 10 79 87
|
|
||||||
12 10 44 26 21 36 32 84 98 60 13 12 36 16 63 31 91 35
|
|
||||||
70 39 06 05 55 27 38 48 28 22 34 35 62 62 15 14 94 89 86
|
|
||||||
66 56 68 84 96 21 34 34 34 81 62 40 65 54 62 05 98 03 02 60
|
|
||||||
38 89 46 37 99 54 34 53 36 14 70 26 02 90 45 13 31 61 83 73 47
|
|
||||||
36 10 63 96 60 49 41 05 37 42 14 58 84 93 96 17 09 43 05 43 06 59
|
|
||||||
66 57 87 57 61 28 37 51 84 73 79 15 39 95 88 87 43 39 11 86 77 74 18
|
|
||||||
54 42 05 79 30 49 99 73 46 37 50 02 45 09 54 52 27 95 27 65 19 45 26 45
|
|
||||||
71 39 17 78 76 29 52 90 18 99 78 19 35 62 71 19 23 65 93 85 49 33 75 09 02
|
|
||||||
33 24 47 61 60 55 32 88 57 55 91 54 46 57 07 77 98 52 80 99 24 25 46 78 79 05
|
|
||||||
92 09 13 55 10 67 26 78 76 82 63 49 51 31 24 68 05 57 07 54 69 21 67 43 17 63 12
|
|
||||||
24 59 06 08 98 74 66 26 61 60 13 03 09 09 24 30 71 08 88 70 72 70 29 90 11 82 41 34
|
|
||||||
66 82 67 04 36 60 92 77 91 85 62 49 59 61 30 90 29 94 26 41 89 04 53 22 83 41 09 74 90
|
|
||||||
48 28 26 37 28 52 77 26 51 32 18 98 79 36 62 13 17 08 19 54 89 29 73 68 42 14 08 16 70 37
|
|
||||||
37 60 69 70 72 71 09 59 13 60 38 13 57 36 09 30 43 89 30 39 15 02 44 73 05 73 26 63 56 86 12
|
|
||||||
55 55 85 50 62 99 84 77 28 85 03 21 27 22 19 26 82 69 54 04 13 07 85 14 01 15 70 59 89 95 10 19
|
|
||||||
04 09 31 92 91 38 92 86 98 75 21 05 64 42 62 84 36 20 73 42 21 23 22 51 51 79 25 45 85 53 03 43 22
|
|
||||||
75 63 02 49 14 12 89 14 60 78 92 16 44 82 38 30 72 11 46 52 90 27 08 65 78 03 85 41 57 79 39 52 33 48
|
|
||||||
78 27 56 56 39 13 19 43 86 72 58 95 39 07 04 34 21 98 39 15 39 84 89 69 84 46 37 57 59 35 59 50 26 15 93
|
|
||||||
42 89 36 27 78 91 24 11 17 41 05 94 07 69 51 96 03 96 47 90 90 45 91 20 50 56 10 32 36 49 04 53 85 92 25 65
|
|
||||||
52 09 61 30 61 97 66 21 96 92 98 90 06 34 96 60 32 69 68 33 75 84 18 31 71 50 84 63 03 03 19 11 28 42 75 45 45
|
|
||||||
61 31 61 68 96 34 49 39 05 71 76 59 62 67 06 47 96 99 34 21 32 47 52 07 71 60 42 72 94 56 82 83 84 40 94 87 82 46
|
|
||||||
01 20 60 14 17 38 26 78 66 81 45 95 18 51 98 81 48 16 53 88 37 52 69 95 72 93 22 34 98 20 54 27 73 61 56 63 60 34 63
|
|
||||||
93 42 94 83 47 61 27 51 79 79 45 01 44 73 31 70 83 42 88 25 53 51 30 15 65 94 80 44 61 84 12 77 02 62 02 65 94 42 14 94
|
|
||||||
32 73 09 67 68 29 74 98 10 19 85 48 38 31 85 67 53 93 93 77 47 67 39 72 94 53 18 43 77 40 78 32 29 59 24 06 02 83 50 60 66
|
|
||||||
32 01 44 30 16 51 15 81 98 15 10 62 86 79 50 62 45 60 70 38 31 85 65 61 64 06 69 84 14 22 56 43 09 48 66 69 83 91 60 40 36 61
|
|
||||||
92 48 22 99 15 95 64 43 01 16 94 02 99 19 17 69 11 58 97 56 89 31 77 45 67 96 12 73 08 20 36 47 81 44 50 64 68 85 40 81 85 52 09
|
|
||||||
91 35 92 45 32 84 62 15 19 64 21 66 06 01 52 80 62 59 12 25 88 28 91 50 40 16 22 99 92 79 87 51 21 77 74 77 07 42 38 42 74 83 02 05
|
|
||||||
46 19 77 66 24 18 05 32 02 84 31 99 92 58 96 72 91 36 62 99 55 29 53 42 12 37 26 58 89 50 66 19 82 75 12 48 24 87 91 85 02 07 03 76 86
|
|
||||||
99 98 84 93 07 17 33 61 92 20 66 60 24 66 40 30 67 05 37 29 24 96 03 27 70 62 13 04 45 47 59 88 43 20 66 15 46 92 30 04 71 66 78 70 53 99
|
|
||||||
67 60 38 06 88 04 17 72 10 99 71 07 42 25 54 05 26 64 91 50 45 71 06 30 67 48 69 82 08 56 80 67 18 46 66 63 01 20 08 80 47 07 91 16 03 79 87
|
|
||||||
18 54 78 49 80 48 77 40 68 23 60 88 58 80 33 57 11 69 55 53 64 02 94 49 60 92 16 35 81 21 82 96 25 24 96 18 02 05 49 03 50 77 06 32 84 27 18 38
|
|
||||||
68 01 50 04 03 21 42 94 53 24 89 05 92 26 52 36 68 11 85 01 04 42 02 45 15 06 50 04 53 73 25 74 81 88 98 21 67 84 79 97 99 20 95 04 40 46 02 58 87
|
|
||||||
94 10 02 78 88 52 21 03 88 60 06 53 49 71 20 91 12 65 07 49 21 22 11 41 58 99 36 16 09 48 17 24 52 36 23 15 72 16 84 56 02 99 43 76 81 71 29 39 49 17
|
|
||||||
64 39 59 84 86 16 17 66 03 09 43 06 64 18 63 29 68 06 23 07 87 14 26 35 17 12 98 41 53 64 78 18 98 27 28 84 80 67 75 62 10 11 76 90 54 10 05 54 41 39 66
|
|
||||||
43 83 18 37 32 31 52 29 95 47 08 76 35 11 04 53 35 43 34 10 52 57 12 36 20 39 40 55 78 44 07 31 38 26 08 15 56 88 86 01 52 62 10 24 32 05 60 65 53 28 57 99
|
|
||||||
03 50 03 52 07 73 49 92 66 80 01 46 08 67 25 36 73 93 07 42 25 53 13 96 76 83 87 90 54 89 78 22 78 91 73 51 69 09 79 94 83 53 09 40 69 62 10 79 49 47 03 81 30
|
|
||||||
71 54 73 33 51 76 59 54 79 37 56 45 84 17 62 21 98 69 41 95 65 24 39 37 62 03 24 48 54 64 46 82 71 78 33 67 09 16 96 68 52 74 79 68 32 21 13 78 96 60 09 69 20 36
|
|
||||||
73 26 21 44 46 38 17 83 65 98 07 23 52 46 61 97 33 13 60 31 70 15 36 77 31 58 56 93 75 68 21 36 69 53 90 75 25 82 39 50 65 94 29 30 11 33 11 13 96 02 56 47 07 49 02
|
|
||||||
76 46 73 30 10 20 60 70 14 56 34 26 37 39 48 24 55 76 84 91 39 86 95 61 50 14 53 93 64 67 37 31 10 84 42 70 48 20 10 72 60 61 84 79 69 65 99 73 89 25 85 48 92 56 97 16
|
|
||||||
03 14 80 27 22 30 44 27 67 75 79 32 51 54 81 29 65 14 19 04 13 82 04 91 43 40 12 52 29 99 07 76 60 25 01 07 61 71 37 92 40 47 99 66 57 01 43 44 22 40 53 53 09 69 26 81 07
|
|
||||||
49 80 56 90 93 87 47 13 75 28 87 23 72 79 32 18 27 20 28 10 37 59 21 18 70 04 79 96 03 31 45 71 81 06 14 18 17 05 31 50 92 79 23 47 09 39 47 91 43 54 69 47 42 95 62 46 32 85
|
|
||||||
37 18 62 85 87 28 64 05 77 51 47 26 30 65 05 70 65 75 59 80 42 52 25 20 44 10 92 17 71 95 52 14 77 13 24 55 11 65 26 91 01 30 63 15 49 48 41 17 67 47 03 68 20 90 98 32 04 40 68
|
|
||||||
90 51 58 60 06 55 23 68 05 19 76 94 82 36 96 43 38 90 87 28 33 83 05 17 70 83 96 93 06 04 78 47 80 06 23 84 75 23 87 72 99 14 50 98 92 38 90 64 61 58 76 94 36 66 87 80 51 35 61 38
|
|
||||||
57 95 64 06 53 36 82 51 40 33 47 14 07 98 78 65 39 58 53 06 50 53 04 69 40 68 36 69 75 78 75 60 03 32 39 24 74 47 26 90 13 40 44 71 90 76 51 24 36 50 25 45 70 80 61 80 61 43 90 64 11
|
|
||||||
18 29 86 56 68 42 79 10 42 44 30 12 96 18 23 18 52 59 02 99 67 46 60 86 43 38 55 17 44 93 42 21 55 14 47 34 55 16 49 24 23 29 96 51 55 10 46 53 27 92 27 46 63 57 30 65 43 27 21 20 24 83
|
|
||||||
81 72 93 19 69 52 48 01 13 83 92 69 20 48 69 59 20 62 05 42 28 89 90 99 32 72 84 17 08 87 36 03 60 31 36 36 81 26 97 36 48 54 56 56 27 16 91 08 23 11 87 99 33 47 02 14 44 73 70 99 43 35 33
|
|
||||||
90 56 61 86 56 12 70 59 63 32 01 15 81 47 71 76 95 32 65 80 54 70 34 51 40 45 33 04 64 55 78 68 88 47 31 47 68 87 03 84 23 44 89 72 35 08 31 76 63 26 90 85 96 67 65 91 19 14 17 86 04 71 32 95
|
|
||||||
37 13 04 22 64 37 37 28 56 62 86 33 07 37 10 44 52 82 52 06 19 52 57 75 90 26 91 24 06 21 14 67 76 30 46 14 35 89 89 41 03 64 56 97 87 63 22 34 03 79 17 45 11 53 25 56 96 61 23 18 63 31 37 37 47
|
|
||||||
77 23 26 70 72 76 77 04 28 64 71 69 14 85 96 54 95 48 06 62 99 83 86 77 97 75 71 66 30 19 57 90 33 01 60 61 14 12 90 99 32 77 56 41 18 14 87 49 10 14 90 64 18 50 21 74 14 16 88 05 45 73 82 47 74 44
|
|
||||||
22 97 41 13 34 31 54 61 56 94 03 24 59 27 98 77 04 09 37 40 12 26 87 09 71 70 07 18 64 57 80 21 12 71 83 94 60 39 73 79 73 19 97 32 64 29 41 07 48 84 85 67 12 74 95 20 24 52 41 67 56 61 29 93 35 72 69
|
|
||||||
72 23 63 66 01 11 07 30 52 56 95 16 65 26 83 90 50 74 60 18 16 48 43 77 37 11 99 98 30 94 91 26 62 73 45 12 87 73 47 27 01 88 66 99 21 41 95 80 02 53 23 32 61 48 32 43 43 83 14 66 95 91 19 81 80 67 25 88
|
|
||||||
08 62 32 18 92 14 83 71 37 96 11 83 39 99 05 16 23 27 10 67 02 25 44 11 55 31 46 64 41 56 44 74 26 81 51 31 45 85 87 09 81 95 22 28 76 69 46 48 64 87 67 76 27 89 31 11 74 16 62 03 60 94 42 47 09 34 94 93 72
|
|
||||||
56 18 90 18 42 17 42 32 14 86 06 53 33 95 99 35 29 15 44 20 49 59 25 54 34 59 84 21 23 54 35 90 78 16 93 13 37 88 54 19 86 67 68 55 66 84 65 42 98 37 87 56 33 28 58 38 28 38 66 27 52 21 81 15 08 22 97 32 85 27
|
|
||||||
91 53 40 28 13 34 91 25 01 63 50 37 22 49 71 58 32 28 30 18 68 94 23 83 63 62 94 76 80 41 90 22 82 52 29 12 18 56 10 08 35 14 37 57 23 65 67 40 72 39 93 39 70 89 40 34 07 46 94 22 20 05 53 64 56 30 05 56 61 88 27
|
|
||||||
23 95 11 12 37 69 68 24 66 10 87 70 43 50 75 07 62 41 83 58 95 93 89 79 45 39 02 22 05 22 95 43 62 11 68 29 17 40 26 44 25 71 87 16 70 85 19 25 59 94 90 41 41 80 61 70 55 60 84 33 95 76 42 63 15 09 03 40 38 12 03 32
|
|
||||||
09 84 56 80 61 55 85 97 16 94 82 94 98 57 84 30 84 48 93 90 71 05 95 90 73 17 30 98 40 64 65 89 07 79 09 19 56 36 42 30 23 69 73 72 07 05 27 61 24 31 43 48 71 84 21 28 26 65 65 59 65 74 77 20 10 81 61 84 95 08 52 23 70
|
|
||||||
47 81 28 09 98 51 67 64 35 51 59 36 92 82 77 65 80 24 72 53 22 07 27 10 21 28 30 22 48 82 80 48 56 20 14 43 18 25 50 95 90 31 77 08 09 48 44 80 90 22 93 45 82 17 13 96 25 26 08 73 34 99 06 49 24 06 83 51 40 14 15 10 25 01
|
|
||||||
54 25 10 81 30 64 24 74 75 80 36 75 82 60 22 69 72 91 45 67 03 62 79 54 89 74 44 83 64 96 66 73 44 30 74 50 37 05 09 97 70 01 60 46 37 91 39 75 75 18 58 52 72 78 51 81 86 52 08 97 01 46 43 66 98 62 81 18 70 93 73 08 32 46 34
|
|
||||||
96 80 82 07 59 71 92 53 19 20 88 66 03 26 26 10 24 27 50 82 94 73 63 08 51 33 22 45 19 13 58 33 90 15 22 50 36 13 55 06 35 47 82 52 33 61 36 27 28 46 98 14 73 20 73 32 16 26 80 53 47 66 76 38 94 45 02 01 22 52 47 96 64 58 52 39
|
|
||||||
88 46 23 39 74 63 81 64 20 90 33 33 76 55 58 26 10 46 42 26 74 74 12 83 32 43 09 02 73 55 86 54 85 34 28 23 29 79 91 62 47 41 82 87 99 22 48 90 20 05 96 75 95 04 43 28 81 39 81 01 28 42 78 25 39 77 90 57 58 98 17 36 73 22 63 74 51
|
|
||||||
29 39 74 94 95 78 64 24 38 86 63 87 93 06 70 92 22 16 80 64 29 52 20 27 23 50 14 13 87 15 72 96 81 22 08 49 72 30 70 24 79 31 16 64 59 21 89 34 96 91 48 76 43 53 88 01 57 80 23 81 90 79 58 01 80 87 17 99 86 90 72 63 32 69 14 28 88 69
|
|
||||||
37 17 71 95 56 93 71 35 43 45 04 98 92 94 84 96 11 30 31 27 31 60 92 03 48 05 98 91 86 94 35 90 90 08 48 19 33 28 68 37 59 26 65 96 50 68 22 07 09 49 34 31 77 49 43 06 75 17 81 87 61 79 52 26 27 72 29 50 07 98 86 01 17 10 46 64 24 18 56
|
|
||||||
51 30 25 94 88 85 79 91 40 33 63 84 49 67 98 92 15 26 75 19 82 05 18 78 65 93 61 48 91 43 59 41 70 51 22 15 92 81 67 91 46 98 11 11 65 31 66 10 98 65 83 21 05 56 05 98 73 67 46 74 69 34 08 30 05 52 07 98 32 95 30 94 65 50 24 63 28 81 99 57
|
|
||||||
19 23 61 36 09 89 71 98 65 17 30 29 89 26 79 74 94 11 44 48 97 54 81 55 39 66 69 45 28 47 13 86 15 76 74 70 84 32 36 33 79 20 78 14 41 47 89 28 81 05 99 66 81 86 38 26 06 25 13 60 54 55 23 53 27 05 89 25 23 11 13 54 59 54 56 34 16 24 53 44 06
|
|
||||||
13 40 57 72 21 15 60 08 04 19 11 98 34 45 09 97 86 71 03 15 56 19 15 44 97 31 90 04 87 87 76 08 12 30 24 62 84 28 12 85 82 53 99 52 13 94 06 65 97 86 09 50 94 68 69 74 30 67 87 94 63 07 78 27 80 36 69 41 06 92 32 78 37 82 30 05 18 87 99 72 19 99
|
|
||||||
44 20 55 77 69 91 27 31 28 81 80 27 02 07 97 23 95 98 12 25 75 29 47 71 07 47 78 39 41 59 27 76 13 15 66 61 68 35 69 86 16 53 67 63 99 85 41 56 08 28 33 40 94 76 90 85 31 70 24 65 84 65 99 82 19 25 54 37 21 46 33 02 52 99 51 33 26 04 87 02 08 18 96
|
|
||||||
54 42 61 45 91 06 64 79 80 82 32 16 83 63 42 49 19 78 65 97 40 42 14 61 49 34 04 18 25 98 59 30 82 72 26 88 54 36 21 75 03 88 99 53 46 51 55 78 22 94 34 40 68 87 84 25 30 76 25 08 92 84 42 61 40 38 09 99 40 23 29 39 46 55 10 90 35 84 56 70 63 23 91 39
|
|
||||||
52 92 03 71 89 07 09 37 68 66 58 20 44 92 51 56 13 71 79 99 26 37 02 06 16 67 36 52 58 16 79 73 56 60 59 27 44 77 94 82 20 50 98 33 09 87 94 37 40 83 64 83 58 85 17 76 53 02 83 52 22 27 39 20 48 92 45 21 09 42 24 23 12 37 52 28 50 78 79 20 86 62 73 20 59
|
|
||||||
54 96 80 15 91 90 99 70 10 09 58 90 93 50 81 99 54 38 36 10 30 11 35 84 16 45 82 18 11 97 36 43 96 79 97 65 40 48 23 19 17 31 64 52 65 65 37 32 65 76 99 79 34 65 79 27 55 33 03 01 33 27 61 28 66 08 04 70 49 46 48 83 01 45 19 96 13 81 14 21 31 79 93 85 50 05
|
|
||||||
92 92 48 84 59 98 31 53 23 27 15 22 79 95 24 76 05 79 16 93 97 89 38 89 42 83 02 88 94 95 82 21 01 97 48 39 31 78 09 65 50 56 97 61 01 07 65 27 21 23 14 15 80 97 44 78 49 35 33 45 81 74 34 05 31 57 09 38 94 07 69 54 69 32 65 68 46 68 78 90 24 28 49 51 45 86 35
|
|
||||||
41 63 89 76 87 31 86 09 46 14 87 82 22 29 47 16 13 10 70 72 82 95 48 64 58 43 13 75 42 69 21 12 67 13 64 85 58 23 98 09 37 76 05 22 31 12 66 50 29 99 86 72 45 25 10 28 19 06 90 43 29 31 67 79 46 25 74 14 97 35 76 37 65 46 23 82 06 22 30 76 93 66 94 17 96 13 20 72
|
|
||||||
63 40 78 08 52 09 90 41 70 28 36 14 46 44 85 96 24 52 58 15 87 37 05 98 99 39 13 61 76 38 44 99 83 74 90 22 53 80 56 98 30 51 63 39 44 30 91 91 04 22 27 73 17 35 53 18 35 45 54 56 27 78 48 13 69 36 44 38 71 25 30 56 15 22 73 43 32 69 59 25 93 83 45 11 34 94 44 39 92
|
|
||||||
12 36 56 88 13 96 16 12 55 54 11 47 19 78 17 17 68 81 77 51 42 55 99 85 66 27 81 79 93 42 65 61 69 74 14 01 18 56 12 01 58 37 91 22 42 66 83 25 19 04 96 41 25 45 18 69 96 88 36 93 10 12 98 32 44 83 83 04 72 91 04 27 73 07 34 37 71 60 59 31 01 54 54 44 96 93 83 36 04 45
|
|
||||||
30 18 22 20 42 96 65 79 17 41 55 69 94 81 29 80 91 31 85 25 47 26 43 49 02 99 34 67 99 76 16 14 15 93 08 32 99 44 61 77 67 50 43 55 87 55 53 72 17 46 62 25 50 99 73 05 93 48 17 31 70 80 59 09 44 59 45 13 74 66 58 94 87 73 16 14 85 38 74 99 64 23 79 28 71 42 20 37 82 31 23
|
|
||||||
51 96 39 65 46 71 56 13 29 68 53 86 45 33 51 49 12 91 21 21 76 85 02 17 98 15 46 12 60 21 88 30 92 83 44 59 42 50 27 88 46 86 94 73 45 54 23 24 14 10 94 21 20 34 23 51 04 83 99 75 90 63 60 16 22 33 83 70 11 32 10 50 29 30 83 46 11 05 31 17 86 42 49 01 44 63 28 60 07 78 95 40
|
|
||||||
44 61 89 59 04 49 51 27 69 71 46 76 44 04 09 34 56 39 15 06 94 91 75 90 65 27 56 23 74 06 23 33 36 69 14 39 05 34 35 57 33 22 76 46 56 10 61 65 98 09 16 69 04 62 65 18 99 76 49 18 72 66 73 83 82 40 76 31 89 91 27 88 17 35 41 35 32 51 32 67 52 68 74 85 80 57 07 11 62 66 47 22 67
|
|
||||||
65 37 19 97 26 17 16 24 24 17 50 37 64 82 24 36 32 11 68 34 69 31 32 89 79 93 96 68 49 90 14 23 04 04 67 99 81 74 70 74 36 96 68 09 64 39 88 35 54 89 96 58 66 27 88 97 32 14 06 35 78 20 71 06 85 66 57 02 58 91 72 05 29 56 73 48 86 52 09 93 22 57 79 42 12 01 31 68 17 59 63 76 07 77
|
|
||||||
73 81 14 13 17 20 11 09 01 83 08 85 91 70 84 63 62 77 37 07 47 01 59 95 39 69 39 21 99 09 87 02 97 16 92 36 74 71 90 66 33 73 73 75 52 91 11 12 26 53 05 26 26 48 61 50 90 65 01 87 42 47 74 35 22 73 24 26 56 70 52 05 48 41 31 18 83 27 21 39 80 85 26 08 44 02 71 07 63 22 05 52 19 08 20
|
|
||||||
17 25 21 11 72 93 33 49 64 23 53 82 03 13 91 65 85 02 40 05 42 31 77 42 05 36 06 54 04 58 07 76 87 83 25 57 66 12 74 33 85 37 74 32 20 69 03 97 91 68 82 44 19 14 89 28 85 85 80 53 34 87 58 98 88 78 48 65 98 40 11 57 10 67 70 81 60 79 74 72 97 59 79 47 30 20 54 80 89 91 14 05 33 36 79 39
|
|
||||||
60 85 59 39 60 07 57 76 77 92 06 35 15 72 23 41 45 52 95 18 64 79 86 53 56 31 69 11 91 31 84 50 44 82 22 81 41 40 30 42 30 91 48 94 74 76 64 58 74 25 96 57 14 19 03 99 28 83 15 75 99 01 89 85 79 50 03 95 32 67 44 08 07 41 62 64 29 20 14 76 26 55 48 71 69 66 19 72 44 25 14 01 48 74 12 98 07
|
|
||||||
64 66 84 24 18 16 27 48 20 14 47 69 30 86 48 40 23 16 61 21 51 50 26 47 35 33 91 28 78 64 43 68 04 79 51 08 19 60 52 95 06 68 46 86 35 97 27 58 04 65 30 58 99 12 12 75 91 39 50 31 42 64 70 04 46 07 98 73 98 93 37 89 77 91 64 71 64 65 66 21 78 62 81 74 42 20 83 70 73 95 78 45 92 27 34 53 71 15
|
|
||||||
30 11 85 31 34 71 13 48 05 14 44 03 19 67 23 73 19 57 06 90 94 72 57 69 81 62 59 68 88 57 55 69 49 13 07 87 97 80 89 05 71 05 05 26 38 40 16 62 45 99 18 38 98 24 21 26 62 74 69 04 85 57 77 35 58 67 91 79 79 57 86 28 66 34 72 51 76 78 36 95 63 90 08 78 47 63 45 31 22 70 52 48 79 94 15 77 61 67 68
|
|
||||||
23 33 44 81 80 92 93 75 94 88 23 61 39 76 22 03 28 94 32 06 49 65 41 34 18 23 08 47 62 60 03 63 33 13 80 52 31 54 73 43 70 26 16 69 57 87 83 31 03 93 70 81 47 95 77 44 29 68 39 51 56 59 63 07 25 70 07 77 43 53 64 03 94 42 95 39 18 01 66 21 16 97 20 50 90 16 70 10 95 69 29 06 25 61 41 26 15 59 63 35
|
|
||||||
"""
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
from collections import namedtuple
|
|
||||||
|
|
||||||
|
|
||||||
location = namedtuple("location", "xLocation yLocation total fromRight")
|
|
||||||
|
|
||||||
NUM_ROWS = 100
|
|
||||||
|
|
||||||
|
|
||||||
def invert(listNum):
|
|
||||||
for rowCnt in range(0, NUM_ROWS):
|
|
||||||
for colCnt in range(0, len(listNum[rowCnt])):
|
|
||||||
listNum[rowCnt][colCnt] = 100 - listNum[rowCnt][colCnt]
|
|
||||||
|
|
||||||
def removeIf(listNum: list, loc):
|
|
||||||
location = 0
|
|
||||||
while(location < len(listNum)):
|
|
||||||
if((listNum[location].xLocation == loc.xLocation) and (listNum[location].yLocation == loc.yLocation)):
|
|
||||||
del listNum[location]
|
|
||||||
else:
|
|
||||||
location += 1
|
|
||||||
|
|
||||||
def Problem67():
|
|
||||||
listNum = [[59],
|
|
||||||
[73, 41],
|
|
||||||
[52, 40, 9],
|
|
||||||
[26, 53, 6, 34],
|
|
||||||
[10, 51, 87, 86, 81],
|
|
||||||
[61, 95, 66, 57, 25, 68],
|
|
||||||
[90, 81, 80, 38, 92, 67, 73],
|
|
||||||
[30, 28, 51, 76, 81, 18, 75, 44],
|
|
||||||
[84, 14, 95, 87, 62, 81, 17, 78, 58],
|
|
||||||
[21, 46, 71, 58, 2, 79, 62, 39, 31, 9],
|
|
||||||
[56, 34, 35, 53, 78, 31, 81, 18, 90, 93, 15],
|
|
||||||
[78, 53, 4, 21, 84, 93, 32, 13, 97, 11, 37, 51],
|
|
||||||
[45, 3, 81, 79, 5, 18, 78, 86, 13, 30, 63, 99, 95],
|
|
||||||
[39, 87, 96, 28, 3, 38, 42, 17, 82, 87, 58, 7, 22, 57],
|
|
||||||
[ 6, 17, 51, 17, 7, 93, 9, 7, 75, 97, 95, 78, 87, 8, 53],
|
|
||||||
[67, 66, 59, 60, 88, 99, 94, 65, 55, 77, 55, 34, 27, 53, 78, 28],
|
|
||||||
[76, 40, 41, 4, 87, 16, 9, 42, 75, 69, 23, 97, 30, 60, 10, 79, 87],
|
|
||||||
[12, 10, 44, 26, 21, 36, 32, 84, 98, 60, 13, 12, 36, 16, 63, 31, 91, 35],
|
|
||||||
[70, 39, 6, 5, 55, 27, 38, 48, 28, 22, 34, 35, 62, 62, 15, 14, 94, 89, 86],
|
|
||||||
[66, 56, 68, 84, 96, 21, 34, 34, 34, 81, 62, 40, 65, 54, 62, 5, 98, 3, 2, 60],
|
|
||||||
[38, 89, 46, 37, 99, 54, 34, 53, 36, 14, 70, 26, 2, 90, 45, 13, 31, 61, 83, 73, 47],
|
|
||||||
[36, 10, 63, 96, 60, 49, 41, 5, 37, 42, 14, 58, 84, 93, 96, 17, 9, 43, 5, 43, 6, 59],
|
|
||||||
[66, 57, 87, 57, 61, 28, 37, 51, 84, 73, 79, 15, 39, 95, 88, 87, 43, 39, 11, 86, 77, 74, 18],
|
|
||||||
[54, 42, 5, 79, 30, 49, 99, 73, 46, 37, 50, 2, 45, 9, 54, 52, 27, 95, 27, 65, 19, 45, 26, 45],
|
|
||||||
[71, 39, 17, 78, 76, 29, 52, 90, 18, 99, 78, 19, 35, 62, 71, 19, 23, 65, 93, 85, 49, 33, 75, 9, 2],
|
|
||||||
[33, 24, 47, 61, 60, 55, 32, 88, 57, 55, 91, 54, 46, 57, 7, 77, 98, 52, 80, 99, 24, 25, 46, 78, 79, 5],
|
|
||||||
[92, 9, 13, 55, 10, 67, 26, 78, 76, 82, 63, 49, 51, 31, 24, 68, 5, 57, 7, 54, 69, 21, 67, 43, 17, 63, 12],
|
|
||||||
[24, 59, 6, 8, 98, 74, 66, 26, 61, 60, 13, 3, 9, 9, 24, 30, 71, 8, 88, 70, 72, 70, 29, 90, 11, 82, 41, 34],
|
|
||||||
[66, 82, 67, 4, 36, 60, 92, 77, 91, 85, 62, 49, 59, 61, 30, 90, 29, 94, 26, 41, 89, 4, 53, 22, 83, 41, 9, 74, 90],
|
|
||||||
[48, 28, 26, 37, 28, 52, 77, 26, 51, 32, 18, 98, 79, 36, 62, 13, 17, 8, 19, 54, 89, 29, 73, 68, 42, 14, 8, 16, 70, 37],
|
|
||||||
[37, 60, 69, 70, 72, 71, 9, 59, 13, 60, 38, 13, 57, 36, 9, 30, 43, 89, 30, 39, 15, 2, 44, 73, 5, 73, 26, 63, 56, 86, 12],
|
|
||||||
[55, 55, 85, 50, 62, 99, 84, 77, 28, 85, 3, 21, 27, 22, 19, 26, 82, 69, 54, 4, 13, 7, 85, 14, 1, 15, 70, 59, 89, 95, 10, 19],
|
|
||||||
[ 4, 9, 31, 92, 91, 38, 92, 86, 98, 75, 21, 5, 64, 42, 62, 84, 36, 20, 73, 42, 21, 23, 22, 51, 51, 79, 25, 45, 85, 53, 3, 43, 22],
|
|
||||||
[75, 63, 2, 49, 14, 12, 89, 14, 60, 78, 92, 16, 44, 82, 38, 30, 72, 11, 46, 52, 90, 27, 8, 65, 78, 3, 85, 41, 57, 79, 39, 52, 33, 48],
|
|
||||||
[78, 27, 56, 56, 39, 13, 19, 43, 86, 72, 58, 95, 39, 7, 4, 34, 21, 98, 39, 15, 39, 84, 89, 69, 84, 46, 37, 57, 59, 35, 59, 50, 26, 15, 93],
|
|
||||||
[42, 89, 36, 27, 78, 91, 24, 11, 17, 41, 5, 94, 7, 69, 51, 96, 3, 96, 47, 90, 90, 45, 91, 20, 50, 56, 10, 32, 36, 49, 4, 53, 85, 92, 25, 65],
|
|
||||||
[52, 9, 61, 30, 61, 97, 66, 21, 96, 92, 98, 90, 6, 34, 96, 60, 32, 69, 68, 33, 75, 84, 18, 31, 71, 50, 84, 63, 3, 3, 19, 11, 28, 42, 75, 45, 45],
|
|
||||||
[61, 31, 61, 68, 96, 34, 49, 39, 5, 71, 76, 59, 62, 67, 6, 47, 96, 99, 34, 21, 32, 47, 52, 7, 71, 60, 42, 72, 94, 56, 82, 83, 84, 40, 94, 87, 82, 46],
|
|
||||||
[ 1, 20, 60, 14, 17, 38, 26, 78, 66, 81, 45, 95, 18, 51, 98, 81, 48, 16, 53, 88, 37, 52, 69, 95, 72, 93, 22, 34, 98, 20, 54, 27, 73, 61, 56, 63, 60, 34, 63],
|
|
||||||
[93, 42, 94, 83, 47, 61, 27, 51, 79, 79, 45, 1, 44, 73, 31, 70, 83, 42, 88, 25, 53, 51, 30, 15, 65, 94, 80, 44, 61, 84, 12, 77, 2, 62, 2, 65, 94, 42, 14, 94],
|
|
||||||
[32, 73, 9, 67, 68, 29, 74, 98, 10, 19, 85, 48, 38, 31, 85, 67, 53, 93, 93, 77, 47, 67, 39, 72, 94, 53, 18, 43, 77, 40, 78, 32, 29, 59, 24, 6, 2, 83, 50, 60, 66],
|
|
||||||
[32, 1, 44, 30, 16, 51, 15, 81, 98, 15, 10, 62, 86, 79, 50, 62, 45, 60, 70, 38, 31, 85, 65, 61, 64, 6, 69, 84, 14, 22, 56, 43, 9, 48, 66, 69, 83, 91, 60, 40, 36, 61],
|
|
||||||
[92, 48, 22, 99, 15, 95, 64, 43, 1, 16, 94, 2, 99, 19, 17, 69, 11, 58, 97, 56, 89, 31, 77, 45, 67, 96, 12, 73, 8, 20, 36, 47, 81, 44, 50, 64, 68, 85, 40, 81, 85, 52, 9],
|
|
||||||
[91, 35, 92, 45, 32, 84, 62, 15, 19, 64, 21, 66, 6, 1, 52, 80, 62, 59, 12, 25, 88, 28, 91, 50, 40, 16, 22, 99, 92, 79, 87, 51, 21, 77, 74, 77, 7, 42, 38, 42, 74, 83, 2, 5],
|
|
||||||
[46, 19, 77, 66, 24, 18, 5, 32, 2, 84, 31, 99, 92, 58, 96, 72, 91, 36, 62, 99, 55, 29, 53, 42, 12, 37, 26, 58, 89, 50, 66, 19, 82, 75, 12, 48, 24, 87, 91, 85, 2, 7, 3, 76, 86],
|
|
||||||
[99, 98, 84, 93, 7, 17, 33, 61, 92, 20, 66, 60, 24, 66, 40, 30, 67, 5, 37, 29, 24, 96, 3, 27, 70, 62, 13, 4, 45, 47, 59, 88, 43, 20, 66, 15, 46, 92, 30, 4, 71, 66, 78, 70, 53, 99],
|
|
||||||
[67, 60, 38, 6, 88, 4, 17, 72, 10, 99, 71, 7, 42, 25, 54, 5, 26, 64, 91, 50, 45, 71, 6, 30, 67, 48, 69, 82, 8, 56, 80, 67, 18, 46, 66, 63, 1, 20, 8, 80, 47, 7, 91, 16, 3, 79, 87],
|
|
||||||
[18, 54, 78, 49, 80, 48, 77, 40, 68, 23, 60, 88, 58, 80, 33, 57, 11, 69, 55, 53, 64, 2, 94, 49, 60, 92, 16, 35, 81, 21, 82, 96, 25, 24, 96, 18, 2, 5, 49, 3, 50, 77, 6, 32, 84, 27, 18, 38],
|
|
||||||
[68, 1, 50, 4, 3, 21, 42, 94, 53, 24, 89, 5, 92, 26, 52, 36, 68, 11, 85, 1, 4, 42, 2, 45, 15, 6, 50, 4, 53, 73, 25, 74, 81, 88, 98, 21, 67, 84, 79, 97, 99, 20, 95, 4, 40, 46, 2, 58, 87],
|
|
||||||
[94, 10, 2, 78, 88, 52, 21, 3, 88, 60, 6, 53, 49, 71, 20, 91, 12, 65, 7, 49, 21, 22, 11, 41, 58, 99, 36, 16, 9, 48, 17, 24, 52, 36, 23, 15, 72, 16, 84, 56, 2, 99, 43, 76, 81, 71, 29, 39, 49, 17],
|
|
||||||
[64, 39, 59, 84, 86, 16, 17, 66, 3, 9, 43, 6, 64, 18, 63, 29, 68, 6, 23, 7, 87, 14, 26, 35, 17, 12, 98, 41, 53, 64, 78, 18, 98, 27, 28, 84, 80, 67, 75, 62, 10, 11, 76, 90, 54, 10, 5, 54, 41, 39, 66],
|
|
||||||
[43, 83, 18, 37, 32, 31, 52, 29, 95, 47, 8, 76, 35, 11, 4, 53, 35, 43, 34, 10, 52, 57, 12, 36, 20, 39, 40, 55, 78, 44, 7, 31, 38, 26, 8, 15, 56, 88, 86, 1, 52, 62, 10, 24, 32, 5, 60, 65, 53, 28, 57, 99],
|
|
||||||
[ 3, 50, 3, 52, 7, 73, 49, 92, 66, 80, 1, 46, 8, 67, 25, 36, 73, 93, 7, 42, 25, 53, 13, 96, 76, 83, 87, 90, 54, 89, 78, 22, 78, 91, 73, 51, 69, 9, 79, 94, 83, 53, 9, 40, 69, 62, 10, 79, 49, 47, 3, 81, 30],
|
|
||||||
[71, 54, 73, 33, 51, 76, 59, 54, 79, 37, 56, 45, 84, 17, 62, 21, 98, 69, 41, 95, 65, 24, 39, 37, 62, 3, 24, 48, 54, 64, 46, 82, 71, 78, 33, 67, 9, 16, 96, 68, 52, 74, 79, 68, 32, 21, 13, 78, 96, 60, 9, 69, 20, 36],
|
|
||||||
[73, 26, 21, 44, 46, 38, 17, 83, 65, 98, 7, 23, 52, 46, 61, 97, 33, 13, 60, 31, 70, 15, 36, 77, 31, 58, 56, 93, 75, 68, 21, 36, 69, 53, 90, 75, 25, 82, 39, 50, 65, 94, 29, 30, 11, 33, 11, 13, 96, 2, 56, 47, 7, 49, 2],
|
|
||||||
[76, 46, 73, 30, 10, 20, 60, 70, 14, 56, 34, 26, 37, 39, 48, 24, 55, 76, 84, 91, 39, 86, 95, 61, 50, 14, 53, 93, 64, 67, 37, 31, 10, 84, 42, 70, 48, 20, 10, 72, 60, 61, 84, 79, 69, 65, 99, 73, 89, 25, 85, 48, 92, 56, 97, 16],
|
|
||||||
[ 3, 14, 80, 27, 22, 30, 44, 27, 67, 75, 79, 32, 51, 54, 81, 29, 65, 14, 19, 4, 13, 82, 4, 91, 43, 40, 12, 52, 29, 99, 7, 76, 60, 25, 1, 7, 61, 71, 37, 92, 40, 47, 99, 66, 57, 1, 43, 44, 22, 40, 53, 53, 9, 69, 26, 81, 7],
|
|
||||||
[49, 80, 56, 90, 93, 87, 47, 13, 75, 28, 87, 23, 72, 79, 32, 18, 27, 20, 28, 10, 37, 59, 21, 18, 70, 4, 79, 96, 3, 31, 45, 71, 81, 6, 14, 18, 17, 5, 31, 50, 92, 79, 23, 47, 9, 39, 47, 91, 43, 54, 69, 47, 42, 95, 62, 46, 32, 85],
|
|
||||||
[37, 18, 62, 85, 87, 28, 64, 5, 77, 51, 47, 26, 30, 65, 5, 70, 65, 75, 59, 80, 42, 52, 25, 20, 44, 10, 92, 17, 71, 95, 52, 14, 77, 13, 24, 55, 11, 65, 26, 91, 1, 30, 63, 15, 49, 48, 41, 17, 67, 47, 3, 68, 20, 90, 98, 32, 4, 40, 68],
|
|
||||||
[90, 51, 58, 60, 6, 55, 23, 68, 5, 19, 76, 94, 82, 36, 96, 43, 38, 90, 87, 28, 33, 83, 5, 17, 70, 83, 96, 93, 6, 4, 78, 47, 80, 6, 23, 84, 75, 23, 87, 72, 99, 14, 50, 98, 92, 38, 90, 64, 61, 58, 76, 94, 36, 66, 87, 80, 51, 35, 61, 38],
|
|
||||||
[57, 95, 64, 6, 53, 36, 82, 51, 40, 33, 47, 14, 7, 98, 78, 65, 39, 58, 53, 6, 50, 53, 4, 69, 40, 68, 36, 69, 75, 78, 75, 60, 3, 32, 39, 24, 74, 47, 26, 90, 13, 40, 44, 71, 90, 76, 51, 24, 36, 50, 25, 45, 70, 80, 61, 80, 61, 43, 90, 64, 11],
|
|
||||||
[18, 29, 86, 56, 68, 42, 79, 10, 42, 44, 30, 12, 96, 18, 23, 18, 52, 59, 2, 99, 67, 46, 60, 86, 43, 38, 55, 17, 44, 93, 42, 21, 55, 14, 47, 34, 55, 16, 49, 24, 23, 29, 96, 51, 55, 10, 46, 53, 27, 92, 27, 46, 63, 57, 30, 65, 43, 27, 21, 20, 24, 83],
|
|
||||||
[81, 72, 93, 19, 69, 52, 48, 1, 13, 83, 92, 69, 20, 48, 69, 59, 20, 62, 5, 42, 28, 89, 90, 99, 32, 72, 84, 17, 8, 87, 36, 3, 60, 31, 36, 36, 81, 26, 97, 36, 48, 54, 56, 56, 27, 16, 91, 8, 23, 11, 87, 99, 33, 47, 2, 14, 44, 73, 70, 99, 43, 35, 33],
|
|
||||||
[90, 56, 61, 86, 56, 12, 70, 59, 63, 32, 1, 15, 81, 47, 71, 76, 95, 32, 65, 80, 54, 70, 34, 51, 40, 45, 33, 4, 64, 55, 78, 68, 88, 47, 31, 47, 68, 87, 3, 84, 23, 44, 89, 72, 35, 8, 31, 76, 63, 26, 90, 85, 96, 67, 65, 91, 19, 14, 17, 86, 4, 71, 32, 95],
|
|
||||||
[37, 13, 4, 22, 64, 37, 37, 28, 56, 62, 86, 33, 7, 37, 10, 44, 52, 82, 52, 6, 19, 52, 57, 75, 90, 26, 91, 24, 6, 21, 14, 67, 76, 30, 46, 14, 35, 89, 89, 41, 3, 64, 56, 97, 87, 63, 22, 34, 3, 79, 17, 45, 11, 53, 25, 56, 96, 61, 23, 18, 63, 31, 37, 37, 47],
|
|
||||||
[77, 23, 26, 70, 72, 76, 77, 4, 28, 64, 71, 69, 14, 85, 96, 54, 95, 48, 6, 62, 99, 83, 86, 77, 97, 75, 71, 66, 30, 19, 57, 90, 33, 1, 60, 61, 14, 12, 90, 99, 32, 77, 56, 41, 18, 14, 87, 49, 10, 14, 90, 64, 18, 50, 21, 74, 14, 16, 88, 5, 45, 73, 82, 47, 74, 44],
|
|
||||||
[22, 97, 41, 13, 34, 31, 54, 61, 56, 94, 3, 24, 59, 27, 98, 77, 4, 9, 37, 40, 12, 26, 87, 9, 71, 70, 7, 18, 64, 57, 80, 21, 12, 71, 83, 94, 60, 39, 73, 79, 73, 19, 97, 32, 64, 29, 41, 7, 48, 84, 85, 67, 12, 74, 95, 20, 24, 52, 41, 67, 56, 61, 29, 93, 35, 72, 69],
|
|
||||||
[72, 23, 63, 66, 1, 11, 7, 30, 52, 56, 95, 16, 65, 26, 83, 90, 50, 74, 60, 18, 16, 48, 43, 77, 37, 11, 99, 98, 30, 94, 91, 26, 62, 73, 45, 12, 87, 73, 47, 27, 1, 88, 66, 99, 21, 41, 95, 80, 2, 53, 23, 32, 61, 48, 32, 43, 43, 83, 14, 66, 95, 91, 19, 81, 80, 67, 25, 88],
|
|
||||||
[ 8, 62, 32, 18, 92, 14, 83, 71, 37, 96, 11, 83, 39, 99, 5, 16, 23, 27, 10, 67, 2, 25, 44, 11, 55, 31, 46, 64, 41, 56, 44, 74, 26, 81, 51, 31, 45, 85, 87, 9, 81, 95, 22, 28, 76, 69, 46, 48, 64, 87, 67, 76, 27, 89, 31, 11, 74, 16, 62, 3, 60, 94, 42, 47, 9, 34, 94, 93, 72],
|
|
||||||
[56, 18, 90, 18, 42, 17, 42, 32, 14, 86, 6, 53, 33, 95, 99, 35, 29, 15, 44, 20, 49, 59, 25, 54, 34, 59, 84, 21, 23, 54, 35, 90, 78, 16, 93, 13, 37, 88, 54, 19, 86, 67, 68, 55, 66, 84, 65, 42, 98, 37, 87, 56, 33, 28, 58, 38, 28, 38, 66, 27, 52, 21, 81, 15, 8, 22, 97, 32, 85, 27],
|
|
||||||
[91, 53, 40, 28, 13, 34, 91, 25, 1, 63, 50, 37, 22, 49, 71, 58, 32, 28, 30, 18, 68, 94, 23, 83, 63, 62, 94, 76, 80, 41, 90, 22, 82, 52, 29, 12, 18, 56, 10, 8, 35, 14, 37, 57, 23, 65, 67, 40, 72, 39, 93, 39, 70, 89, 40, 34, 7, 46, 94, 22, 20, 5, 53, 64, 56, 30, 5, 56, 61, 88, 27],
|
|
||||||
[23, 95, 11, 12, 37, 69, 68, 24, 66, 10, 87, 70, 43, 50, 75, 7, 62, 41, 83, 58, 95, 93, 89, 79, 45, 39, 2, 22, 5, 22, 95, 43, 62, 11, 68, 29, 17, 40, 26, 44, 25, 71, 87, 16, 70, 85, 19, 25, 59, 94, 90, 41, 41, 80, 61, 70, 55, 60, 84, 33, 95, 76, 42, 63, 15, 9, 3, 40, 38, 12, 3, 32],
|
|
||||||
[ 9, 84, 56, 80, 61, 55, 85, 97, 16, 94, 82, 94, 98, 57, 84, 30, 84, 48, 93, 90, 71, 5, 95, 90, 73, 17, 30, 98, 40, 64, 65, 89, 7, 79, 9, 19, 56, 36, 42, 30, 23, 69, 73, 72, 7, 5, 27, 61, 24, 31, 43, 48, 71, 84, 21, 28, 26, 65, 65, 59, 65, 74, 77, 20, 10, 81, 61, 84, 95, 8, 52, 23, 70],
|
|
||||||
[47, 81, 28, 9, 98, 51, 67, 64, 35, 51, 59, 36, 92, 82, 77, 65, 80, 24, 72, 53, 22, 7, 27, 10, 21, 28, 30, 22, 48, 82, 80, 48, 56, 20, 14, 43, 18, 25, 50, 95, 90, 31, 77, 8, 9, 48, 44, 80, 90, 22, 93, 45, 82, 17, 13, 96, 25, 26, 8, 73, 34, 99, 6, 49, 24, 6, 83, 51, 40, 14, 15, 10, 25, 1],
|
|
||||||
[54, 25, 10, 81, 30, 64, 24, 74, 75, 80, 36, 75, 82, 60, 22, 69, 72, 91, 45, 67, 3, 62, 79, 54, 89, 74, 44, 83, 64, 96, 66, 73, 44, 30, 74, 50, 37, 5, 9, 97, 70, 1, 60, 46, 37, 91, 39, 75, 75, 18, 58, 52, 72, 78, 51, 81, 86, 52, 8, 97, 1, 46, 43, 66, 98, 62, 81, 18, 70, 93, 73, 8, 32, 46, 34],
|
|
||||||
[96, 80, 82, 7, 59, 71, 92, 53, 19, 20, 88, 66, 3, 26, 26, 10, 24, 27, 50, 82, 94, 73, 63, 8, 51, 33, 22, 45, 19, 13, 58, 33, 90, 15, 22, 50, 36, 13, 55, 6, 35, 47, 82, 52, 33, 61, 36, 27, 28, 46, 98, 14, 73, 20, 73, 32, 16, 26, 80, 53, 47, 66, 76, 38, 94, 45, 2, 1, 22, 52, 47, 96, 64, 58, 52, 39],
|
|
||||||
[88, 46, 23, 39, 74, 63, 81, 64, 20, 90, 33, 33, 76, 55, 58, 26, 10, 46, 42, 26, 74, 74, 12, 83, 32, 43, 9, 2, 73, 55, 86, 54, 85, 34, 28, 23, 29, 79, 91, 62, 47, 41, 82, 87, 99, 22, 48, 90, 20, 5, 96, 75, 95, 4, 43, 28, 81, 39, 81, 1, 28, 42, 78, 25, 39, 77, 90, 57, 58, 98, 17, 36, 73, 22, 63, 74, 51],
|
|
||||||
[29, 39, 74, 94, 95, 78, 64, 24, 38, 86, 63, 87, 93, 6, 70, 92, 22, 16, 80, 64, 29, 52, 20, 27, 23, 50, 14, 13, 87, 15, 72, 96, 81, 22, 8, 49, 72, 30, 70, 24, 79, 31, 16, 64, 59, 21, 89, 34, 96, 91, 48, 76, 43, 53, 88, 1, 57, 80, 23, 81, 90, 79, 58, 1, 80, 87, 17, 99, 86, 90, 72, 63, 32, 69, 14, 28, 88, 69],
|
|
||||||
[37, 17, 71, 95, 56, 93, 71, 35, 43, 45, 4, 98, 92, 94, 84, 96, 11, 30, 31, 27, 31, 60, 92, 3, 48, 5, 98, 91, 86, 94, 35, 90, 90, 8, 48, 19, 33, 28, 68, 37, 59, 26, 65, 96, 50, 68, 22, 7, 9, 49, 34, 31, 77, 49, 43, 6, 75, 17, 81, 87, 61, 79, 52, 26, 27, 72, 29, 50, 7, 98, 86, 1, 17, 10, 46, 64, 24, 18, 56],
|
|
||||||
[51, 30, 25, 94, 88, 85, 79, 91, 40, 33, 63, 84, 49, 67, 98, 92, 15, 26, 75, 19, 82, 5, 18, 78, 65, 93, 61, 48, 91, 43, 59, 41, 70, 51, 22, 15, 92, 81, 67, 91, 46, 98, 11, 11, 65, 31, 66, 10, 98, 65, 83, 21, 5, 56, 5, 98, 73, 67, 46, 74, 69, 34, 8, 30, 5, 52, 7, 98, 32, 95, 30, 94, 65, 50, 24, 63, 28, 81, 99, 57],
|
|
||||||
[19, 23, 61, 36, 9, 89, 71, 98, 65, 17, 30, 29, 89, 26, 79, 74, 94, 11, 44, 48, 97, 54, 81, 55, 39, 66, 69, 45, 28, 47, 13, 86, 15, 76, 74, 70, 84, 32, 36, 33, 79, 20, 78, 14, 41, 47, 89, 28, 81, 5, 99, 66, 81, 86, 38, 26, 6, 25, 13, 60, 54, 55, 23, 53, 27, 5, 89, 25, 23, 11, 13, 54, 59, 54, 56, 34, 16, 24, 53, 44, 6],
|
|
||||||
[13, 40, 57, 72, 21, 15, 60, 8, 4, 19, 11, 98, 34, 45, 9, 97, 86, 71, 3, 15, 56, 19, 15, 44, 97, 31, 90, 4, 87, 87, 76, 8, 12, 30, 24, 62, 84, 28, 12, 85, 82, 53, 99, 52, 13, 94, 6, 65, 97, 86, 9, 50, 94, 68, 69, 74, 30, 67, 87, 94, 63, 7, 78, 27, 80, 36, 69, 41, 6, 92, 32, 78, 37, 82, 30, 5, 18, 87, 99, 72, 19, 99],
|
|
||||||
[44, 20, 55, 77, 69, 91, 27, 31, 28, 81, 80, 27, 2, 7, 97, 23, 95, 98, 12, 25, 75, 29, 47, 71, 7, 47, 78, 39, 41, 59, 27, 76, 13, 15, 66, 61, 68, 35, 69, 86, 16, 53, 67, 63, 99, 85, 41, 56, 8, 28, 33, 40, 94, 76, 90, 85, 31, 70, 24, 65, 84, 65, 99, 82, 19, 25, 54, 37, 21, 46, 33, 2, 52, 99, 51, 33, 26, 4, 87, 2, 8, 18, 96],
|
|
||||||
[54, 42, 61, 45, 91, 6, 64, 79, 80, 82, 32, 16, 83, 63, 42, 49, 19, 78, 65, 97, 40, 42, 14, 61, 49, 34, 4, 18, 25, 98, 59, 30, 82, 72, 26, 88, 54, 36, 21, 75, 3, 88, 99, 53, 46, 51, 55, 78, 22, 94, 34, 40, 68, 87, 84, 25, 30, 76, 25, 8, 92, 84, 42, 61, 40, 38, 9, 99, 40, 23, 29, 39, 46, 55, 10, 90, 35, 84, 56, 70, 63, 23, 91, 39],
|
|
||||||
[52, 92, 3, 71, 89, 7, 9, 37, 68, 66, 58, 20, 44, 92, 51, 56, 13, 71, 79, 99, 26, 37, 2, 6, 16, 67, 36, 52, 58, 16, 79, 73, 56, 60, 59, 27, 44, 77, 94, 82, 20, 50, 98, 33, 9, 87, 94, 37, 40, 83, 64, 83, 58, 85, 17, 76, 53, 2, 83, 52, 22, 27, 39, 20, 48, 92, 45, 21, 9, 42, 24, 23, 12, 37, 52, 28, 50, 78, 79, 20, 86, 62, 73, 20, 59],
|
|
||||||
[54, 96, 80, 15, 91, 90, 99, 70, 10, 9, 58, 90, 93, 50, 81, 99, 54, 38, 36, 10, 30, 11, 35, 84, 16, 45, 82, 18, 11, 97, 36, 43, 96, 79, 97, 65, 40, 48, 23, 19, 17, 31, 64, 52, 65, 65, 37, 32, 65, 76, 99, 79, 34, 65, 79, 27, 55, 33, 3, 1, 33, 27, 61, 28, 66, 8, 4, 70, 49, 46, 48, 83, 1, 45, 19, 96, 13, 81, 14, 21, 31, 79, 93, 85, 50, 5],
|
|
||||||
[92, 92, 48, 84, 59, 98, 31, 53, 23, 27, 15, 22, 79, 95, 24, 76, 5, 79, 16, 93, 97, 89, 38, 89, 42, 83, 2, 88, 94, 95, 82, 21, 1, 97, 48, 39, 31, 78, 9, 65, 50, 56, 97, 61, 1, 7, 65, 27, 21, 23, 14, 15, 80, 97, 44, 78, 49, 35, 33, 45, 81, 74, 34, 5, 31, 57, 9, 38, 94, 7, 69, 54, 69, 32, 65, 68, 46, 68, 78, 90, 24, 28, 49, 51, 45, 86, 35],
|
|
||||||
[41, 63, 89, 76, 87, 31, 86, 9, 46, 14, 87, 82, 22, 29, 47, 16, 13, 10, 70, 72, 82, 95, 48, 64, 58, 43, 13, 75, 42, 69, 21, 12, 67, 13, 64, 85, 58, 23, 98, 9, 37, 76, 5, 22, 31, 12, 66, 50, 29, 99, 86, 72, 45, 25, 10, 28, 19, 6, 90, 43, 29, 31, 67, 79, 46, 25, 74, 14, 97, 35, 76, 37, 65, 46, 23, 82, 6, 22, 30, 76, 93, 66, 94, 17, 96, 13, 20, 72],
|
|
||||||
[63, 40, 78, 8, 52, 9, 90, 41, 70, 28, 36, 14, 46, 44, 85, 96, 24, 52, 58, 15, 87, 37, 5, 98, 99, 39, 13, 61, 76, 38, 44, 99, 83, 74, 90, 22, 53, 80, 56, 98, 30, 51, 63, 39, 44, 30, 91, 91, 4, 22, 27, 73, 17, 35, 53, 18, 35, 45, 54, 56, 27, 78, 48, 13, 69, 36, 44, 38, 71, 25, 30, 56, 15, 22, 73, 43, 32, 69, 59, 25, 93, 83, 45, 11, 34, 94, 44, 39, 92],
|
|
||||||
[12, 36, 56, 88, 13, 96, 16, 12, 55, 54, 11, 47, 19, 78, 17, 17, 68, 81, 77, 51, 42, 55, 99, 85, 66, 27, 81, 79, 93, 42, 65, 61, 69, 74, 14, 1, 18, 56, 12, 1, 58, 37, 91, 22, 42, 66, 83, 25, 19, 4, 96, 41, 25, 45, 18, 69, 96, 88, 36, 93, 10, 12, 98, 32, 44, 83, 83, 4, 72, 91, 4, 27, 73, 7, 34, 37, 71, 60, 59, 31, 1, 54, 54, 44, 96, 93, 83, 36, 4, 45],
|
|
||||||
[30, 18, 22, 20, 42, 96, 65, 79, 17, 41, 55, 69, 94, 81, 29, 80, 91, 31, 85, 25, 47, 26, 43, 49, 2, 99, 34, 67, 99, 76, 16, 14, 15, 93, 8, 32, 99, 44, 61, 77, 67, 50, 43, 55, 87, 55, 53, 72, 17, 46, 62, 25, 50, 99, 73, 5, 93, 48, 17, 31, 70, 80, 59, 9, 44, 59, 45, 13, 74, 66, 58, 94, 87, 73, 16, 14, 85, 38, 74, 99, 64, 23, 79, 28, 71, 42, 20, 37, 82, 31, 23],
|
|
||||||
[51, 96, 39, 65, 46, 71, 56, 13, 29, 68, 53, 86, 45, 33, 51, 49, 12, 91, 21, 21, 76, 85, 2, 17, 98, 15, 46, 12, 60, 21, 88, 30, 92, 83, 44, 59, 42, 50, 27, 88, 46, 86, 94, 73, 45, 54, 23, 24, 14, 10, 94, 21, 20, 34, 23, 51, 4, 83, 99, 75, 90, 63, 60, 16, 22, 33, 83, 70, 11, 32, 10, 50, 29, 30, 83, 46, 11, 5, 31, 17, 86, 42, 49, 1, 44, 63, 28, 60, 7, 78, 95, 40],
|
|
||||||
[44, 61, 89, 59, 4, 49, 51, 27, 69, 71, 46, 76, 44, 4, 9, 34, 56, 39, 15, 6, 94, 91, 75, 90, 65, 27, 56, 23, 74, 6, 23, 33, 36, 69, 14, 39, 5, 34, 35, 57, 33, 22, 76, 46, 56, 10, 61, 65, 98, 9, 16, 69, 4, 62, 65, 18, 99, 76, 49, 18, 72, 66, 73, 83, 82, 40, 76, 31, 89, 91, 27, 88, 17, 35, 41, 35, 32, 51, 32, 67, 52, 68, 74, 85, 80, 57, 7, 11, 62, 66, 47, 22, 67],
|
|
||||||
[65, 37, 19, 97, 26, 17, 16, 24, 24, 17, 50, 37, 64, 82, 24, 36, 32, 11, 68, 34, 69, 31, 32, 89, 79, 93, 96, 68, 49, 90, 14, 23, 4, 4, 67, 99, 81, 74, 70, 74, 36, 96, 68, 9, 64, 39, 88, 35, 54, 89, 96, 58, 66, 27, 88, 97, 32, 14, 6, 35, 78, 20, 71, 6, 85, 66, 57, 2, 58, 91, 72, 5, 29, 56, 73, 48, 86, 52, 9, 93, 22, 57, 79, 42, 12, 1, 31, 68, 17, 59, 63, 76, 7, 77],
|
|
||||||
[73, 81, 14, 13, 17, 20, 11, 9, 1, 83, 8, 85, 91, 70, 84, 63, 62, 77, 37, 7, 47, 1, 59, 95, 39, 69, 39, 21, 99, 9, 87, 2, 97, 16, 92, 36, 74, 71, 90, 66, 33, 73, 73, 75, 52, 91, 11, 12, 26, 53, 5, 26, 26, 48, 61, 50, 90, 65, 1, 87, 42, 47, 74, 35, 22, 73, 24, 26, 56, 70, 52, 5, 48, 41, 31, 18, 83, 27, 21, 39, 80, 85, 26, 8, 44, 2, 71, 7, 63, 22, 5, 52, 19, 8, 20],
|
|
||||||
[17, 25, 21, 11, 72, 93, 33, 49, 64, 23, 53, 82, 3, 13, 91, 65, 85, 2, 40, 5, 42, 31, 77, 42, 5, 36, 6, 54, 4, 58, 7, 76, 87, 83, 25, 57, 66, 12, 74, 33, 85, 37, 74, 32, 20, 69, 3, 97, 91, 68, 82, 44, 19, 14, 89, 28, 85, 85, 80, 53, 34, 87, 58, 98, 88, 78, 48, 65, 98, 40, 11, 57, 10, 67, 70, 81, 60, 79, 74, 72, 97, 59, 79, 47, 30, 20, 54, 80, 89, 91, 14, 5, 33, 36, 79, 39],
|
|
||||||
[60, 85, 59, 39, 60, 7, 57, 76, 77, 92, 6, 35, 15, 72, 23, 41, 45, 52, 95, 18, 64, 79, 86, 53, 56, 31, 69, 11, 91, 31, 84, 50, 44, 82, 22, 81, 41, 40, 30, 42, 30, 91, 48, 94, 74, 76, 64, 58, 74, 25, 96, 57, 14, 19, 3, 99, 28, 83, 15, 75, 99, 1, 89, 85, 79, 50, 3, 95, 32, 67, 44, 8, 7, 41, 62, 64, 29, 20, 14, 76, 26, 55, 48, 71, 69, 66, 19, 72, 44, 25, 14, 1, 48, 74, 12, 98, 7],
|
|
||||||
[64, 66, 84, 24, 18, 16, 27, 48, 20, 14, 47, 69, 30, 86, 48, 40, 23, 16, 61, 21, 51, 50, 26, 47, 35, 33, 91, 28, 78, 64, 43, 68, 4, 79, 51, 8, 19, 60, 52, 95, 6, 68, 46, 86, 35, 97, 27, 58, 4, 65, 30, 58, 99, 12, 12, 75, 91, 39, 50, 31, 42, 64, 70, 4, 46, 7, 98, 73, 98, 93, 37, 89, 77, 91, 64, 71, 64, 65, 66, 21, 78, 62, 81, 74, 42, 20, 83, 70, 73, 95, 78, 45, 92, 27, 34, 53, 71, 15],
|
|
||||||
[30, 11, 85, 31, 34, 71, 13, 48, 5, 14, 44, 3, 19, 67, 23, 73, 19, 57, 6, 90, 94, 72, 57, 69, 81, 62, 59, 68, 88, 57, 55, 69, 49, 13, 7, 87, 97, 80, 89, 5, 71, 5, 5, 26, 38, 40, 16, 62, 45, 99, 18, 38, 98, 24, 21, 26, 62, 74, 69, 4, 85, 57, 77, 35, 58, 67, 91, 79, 79, 57, 86, 28, 66, 34, 72, 51, 76, 78, 36, 95, 63, 90, 8, 78, 47, 63, 45, 31, 22, 70, 52, 48, 79, 94, 15, 77, 61, 67, 68],
|
|
||||||
[23, 33, 44, 81, 80, 92, 93, 75, 94, 88, 23, 61, 39, 76, 22, 3, 28, 94, 32, 6, 49, 65, 41, 34, 18, 23, 8, 47, 62, 60, 3, 63, 33, 13, 80, 52, 31, 54, 73, 43, 70, 26, 16, 69, 57, 87, 83, 31, 3, 93, 70, 81, 47, 95, 77, 44, 29, 68, 39, 51, 56, 59, 63, 7, 25, 70, 7, 77, 43, 53, 64, 3, 94, 42, 95, 39, 18, 1, 66, 21, 16, 97, 20, 50, 90, 16, 70, 10, 95, 69, 29, 6, 25, 61, 41, 26, 15, 59, 63, 35]]
|
|
||||||
|
|
||||||
#Invert the list so that each element = 100 - element
|
|
||||||
invert(listNum)
|
|
||||||
|
|
||||||
#Holds points we know are of the shortest route
|
|
||||||
foundPoints = []
|
|
||||||
#Add the tip of the pyramid because everything has to go through that
|
|
||||||
foundPoints.append(location(0, 0, listNum[0][0], True))
|
|
||||||
#Holds points that might be the shortest route
|
|
||||||
possiblePoints = []
|
|
||||||
#Add the second row as possible points because everything must pass through the second row
|
|
||||||
possiblePoints.append(location(0, 1, (listNum[0][0] + listNum[1][0]), True))
|
|
||||||
possiblePoints.append(location(1, 1, (listNum[0][0] + listNum[1][1]), False))
|
|
||||||
foundBottom = False
|
|
||||||
|
|
||||||
#Loop until you find the bottom
|
|
||||||
while(not foundBottom):
|
|
||||||
#Check which possible point gives us the lowest number. If more than one has the same number simply keep the first one
|
|
||||||
minLoc = possiblePoints[0]
|
|
||||||
for loc in possiblePoints:
|
|
||||||
if(loc.total < minLoc.total):
|
|
||||||
minLoc = loc
|
|
||||||
|
|
||||||
#Remove it from the list of possible points
|
|
||||||
removeIf(possiblePoints, minLoc)
|
|
||||||
|
|
||||||
foundPoints.append(minLoc)
|
|
||||||
|
|
||||||
#Add to the list of possible points from the point we just found and
|
|
||||||
#If you are at the bottom raise the flag to end the program
|
|
||||||
xLoc = minLoc.xLocation
|
|
||||||
yLoc = minLoc.yLocation + 1
|
|
||||||
if(yLoc >= NUM_ROWS):
|
|
||||||
foundBottom = True
|
|
||||||
else:
|
|
||||||
possiblePoints.append(location(xLoc, yLoc, minLoc.total + listNum[yLoc][xLoc], True))
|
|
||||||
xLoc += 1
|
|
||||||
possiblePoints.append(location(xLoc, yLoc, minLoc.total + listNum[yLoc][xLoc], False))
|
|
||||||
|
|
||||||
#Get the real total of the journey
|
|
||||||
actualTotal = ((100 * NUM_ROWS) - foundPoints[len(foundPoints) - 1].total)
|
|
||||||
|
|
||||||
#Invert the list so it can be read again
|
|
||||||
invert(listNum)
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The value of the longest path is " + str(actualTotal))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch()
|
|
||||||
timer.start()
|
|
||||||
Problem67()
|
|
||||||
timer.stop()
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
""" Results:
|
|
||||||
The value of the longest path is 7273
|
|
||||||
It took 16.483 seconds to run this algorithm
|
|
||||||
"""
|
|
||||||
50
Problem7.py
50
Problem7.py
@@ -1,50 +0,0 @@
|
|||||||
#Project Eulter/Python/Problem7.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 01-29-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#What is the 10001th prime number?
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
from Algorithms import getNumPrimes
|
|
||||||
|
|
||||||
__numPrimes = 10001 #The number of the prime number desired
|
|
||||||
|
|
||||||
|
|
||||||
def Problem7():
|
|
||||||
#Get the correct number of primes
|
|
||||||
primes = getNumPrimes(__numPrimes)
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The " + str(__numPrimes) + "th prime number is " + str(primes[__numPrimes - 1]))
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
|
||||||
if __name__ == '__main__':
|
|
||||||
timer = Stopwatch() #Determines the algorithm's run time
|
|
||||||
timer.start() #Start the timer
|
|
||||||
Problem7() #Call the function that answers the question
|
|
||||||
timer.stop() #Stop the timer
|
|
||||||
#Print the results of the timer
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
"""Results:
|
|
||||||
The 10001th prime number is 104743
|
|
||||||
It took 139.545 milliseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
85
Problem8.py
85
Problem8.py
@@ -1,85 +0,0 @@
|
|||||||
#Project Euler/Python/Problem8.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 01-29-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product?
|
|
||||||
"""
|
|
||||||
73167176531330624919225119674426574742355349194934
|
|
||||||
96983520312774506326239578318016984801869478851843
|
|
||||||
85861560789112949495459501737958331952853208805511
|
|
||||||
12540698747158523863050715693290963295227443043557
|
|
||||||
66896648950445244523161731856403098711121722383113
|
|
||||||
62229893423380308135336276614282806444486645238749
|
|
||||||
30358907296290491560440772390713810515859307960866
|
|
||||||
70172427121883998797908792274921901699720888093776
|
|
||||||
65727333001053367881220235421809751254540594752243
|
|
||||||
52584907711670556013604839586446706324415722155397
|
|
||||||
53697817977846174064955149290862569321978468622482
|
|
||||||
83972241375657056057490261407972968652414535100474
|
|
||||||
82166370484403199890008895243450658541227588666881
|
|
||||||
16427171479924442928230863465674813919123162824586
|
|
||||||
17866458359124566529476545682848912883142607690042
|
|
||||||
24219022671055626321111109370544217506941658960408
|
|
||||||
07198403850962455444362981230987879927244284909188
|
|
||||||
84580156166097919133875499200524063689912560717606
|
|
||||||
05886116467109405077541002256983155200055935729725
|
|
||||||
71636269561882670428252483600823257530420752963450
|
|
||||||
"""
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
|
|
||||||
#The number
|
|
||||||
__number = "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450"
|
|
||||||
|
|
||||||
|
|
||||||
def Problem8():
|
|
||||||
#Setup the variables
|
|
||||||
largestProduct = 0 #Holds the largest product of 13 adjacent digits
|
|
||||||
largestString = "" #Holds the 13 adjacent numbers that produce the largest product
|
|
||||||
|
|
||||||
#Start at the 13th entry and multiply all single digit numbers before and including that number together
|
|
||||||
numberLocation = 12 #The location in the number that you are working from
|
|
||||||
while(numberLocation < len(__number)):
|
|
||||||
currentProduct = int(__number[numberLocation]) * int(__number[numberLocation - 1]) * int(__number[numberLocation - 2]) * int(__number[numberLocation - 3]) * int(__number[numberLocation - 4]) * int(__number[numberLocation - 5]) * int(__number[numberLocation - 6]) * int(__number[numberLocation - 7]) * int(__number[numberLocation - 8]) * int(__number[numberLocation - 9]) * int(__number[numberLocation - 10]) * int(__number[numberLocation - 11]) * int(__number[numberLocation - 12])
|
|
||||||
#Save the largest product
|
|
||||||
if(currentProduct > largestProduct):
|
|
||||||
largestProduct = currentProduct
|
|
||||||
largestString = __number[numberLocation - 12:numberLocation + 1] #Have to add one because it stops before the second subscript
|
|
||||||
#Move to the next location
|
|
||||||
numberLocation += 1
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
print("The largest product of 13 adjacent digits in the number is " + str(largestProduct))
|
|
||||||
print("The numbers are: " + largestString)
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
|
||||||
if __name__ == '__main__':
|
|
||||||
timer = Stopwatch() #Determines the algorithm's run time
|
|
||||||
timer.start() #Start the timer
|
|
||||||
Problem8() #Call the function that answers the question
|
|
||||||
timer.stop() #Stop the timer
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
"""Results:
|
|
||||||
The largest product of 13 adjacent digits in the number is 23514624000
|
|
||||||
The numbers are: 5576689664895
|
|
||||||
It took 2.593 milliseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
73
Problem9.py
73
Problem9.py
@@ -1,73 +0,0 @@
|
|||||||
#Project Euler/Python/Problem9.py
|
|
||||||
#Matthew Ellison
|
|
||||||
# Created: 01-29-19
|
|
||||||
#Modified: 03-28-19
|
|
||||||
#There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc.
|
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
|
||||||
"""
|
|
||||||
Copyright (C) 2019 Matthew Ellison
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
import math
|
|
||||||
|
|
||||||
|
|
||||||
def Problem9():
|
|
||||||
#Setup the variables
|
|
||||||
foundTriplet = False
|
|
||||||
sideA = 1
|
|
||||||
|
|
||||||
#Start with the lowest possible a , 1, and search for the b and c to complete the triplet
|
|
||||||
while((sideA <= (1000 / 3)) and (not foundTriplet)):
|
|
||||||
#Setup b and c
|
|
||||||
sideB = sideA + 1 #b must be > a to be a triplet
|
|
||||||
sideC = math.hypot(sideA, sideB) #C is the hyp
|
|
||||||
#Loop through possible b's and calculate c's until you find the numbers or the sum gets too large
|
|
||||||
while((sideA + sideB + sideC) < 1000):
|
|
||||||
sideB += 1
|
|
||||||
sideC = math.hypot(sideA, sideB)
|
|
||||||
#If c is an integer make it one
|
|
||||||
if((sideC % 1) == 0):
|
|
||||||
sideC = int(round(sideC))
|
|
||||||
#Check if the correct sides were found
|
|
||||||
if((sideA + sideB + sideC) == 1000):
|
|
||||||
foundTriplet = True
|
|
||||||
#Otherwise increment a to the next possible number
|
|
||||||
else:
|
|
||||||
sideA += 1
|
|
||||||
|
|
||||||
#Print the results
|
|
||||||
if(foundTriplet):
|
|
||||||
print("The Pythagorean triplet where a + b + c = 1000 is " + str(sideA) + " " + str(sideB) + " " + str(int(sideC)))
|
|
||||||
print("The product of those numbers is " + str(int(sideA * sideB * sideC)))
|
|
||||||
else:
|
|
||||||
print("Could not find the triplet where a + b + c = 1000")
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
|
||||||
if __name__ == "__main__":
|
|
||||||
timer = Stopwatch() #Determines the algorithm's run time
|
|
||||||
timer.start() #Start the timer
|
|
||||||
Problem9() #Call the function that answers the question
|
|
||||||
timer.stop() #Start the timer
|
|
||||||
#Print the results of the timer
|
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
|
||||||
|
|
||||||
"""Results:
|
|
||||||
The Pythagorean triplet where a + b + c = 1000 is 200 375 425
|
|
||||||
The product of those numbers is 31875000
|
|
||||||
It took 22.106 milliseconds to run this algorithm
|
|
||||||
"""
|
|
||||||
170
ProblemSelection.py
Normal file
170
ProblemSelection.py
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
#ProjectEulerPython/ProblemSelection.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 07-19-20
|
||||||
|
#Modified: 07-19-20
|
||||||
|
#This is the driver function for the Java version of the ProjectEuler project
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Problems.Problem1 import Problem1
|
||||||
|
from Problems.Problem2 import Problem2
|
||||||
|
from Problems.Problem3 import Problem3
|
||||||
|
from Problems.Problem4 import Problem4
|
||||||
|
from Problems.Problem5 import Problem5
|
||||||
|
from Problems.Problem6 import Problem6
|
||||||
|
from Problems.Problem7 import Problem7
|
||||||
|
from Problems.Problem8 import Problem8
|
||||||
|
from Problems.Problem9 import Problem9
|
||||||
|
from Problems.Problem10 import Problem10
|
||||||
|
from Problems.Problem11 import Problem11
|
||||||
|
from Problems.Problem12 import Problem12
|
||||||
|
from Problems.Problem13 import Problem13
|
||||||
|
from Problems.Problem14 import Problem14
|
||||||
|
from Problems.Problem15 import Problem15
|
||||||
|
from Problems.Problem16 import Problem16
|
||||||
|
from Problems.Problem17 import Problem17
|
||||||
|
from Problems.Problem18 import Problem18
|
||||||
|
from Problems.Problem19 import Problem19
|
||||||
|
from Problems.Problem20 import Problem20
|
||||||
|
from Problems.Problem21 import Problem21
|
||||||
|
from Problems.Problem22 import Problem22
|
||||||
|
from Problems.Problem23 import Problem23
|
||||||
|
from Problems.Problem24 import Problem24
|
||||||
|
from Problems.Problem25 import Problem25
|
||||||
|
from Problems.Problem26 import Problem26
|
||||||
|
from Problems.Problem27 import Problem27
|
||||||
|
from Problems.Problem28 import Problem28
|
||||||
|
from Problems.Problem29 import Problem29
|
||||||
|
from Problems.Problem30 import Problem30
|
||||||
|
from Problems.Problem31 import Problem31
|
||||||
|
from Problems.Problem67 import Problem67
|
||||||
|
|
||||||
|
|
||||||
|
class ProblemSelection:
|
||||||
|
#Holds the valid problem numbers
|
||||||
|
problemNumbers = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||||
|
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||||
|
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
|
||||||
|
31, 67]
|
||||||
|
|
||||||
|
#Returns the problem corresponding to the given problem number
|
||||||
|
@staticmethod
|
||||||
|
def getProblem(problemNumber: int) -> Problem:
|
||||||
|
if(problemNumber == 1):
|
||||||
|
return Problem1()
|
||||||
|
elif(problemNumber == 2):
|
||||||
|
return Problem2()
|
||||||
|
elif(problemNumber == 3):
|
||||||
|
return Problem3()
|
||||||
|
elif(problemNumber == 4):
|
||||||
|
return Problem4()
|
||||||
|
elif(problemNumber == 5):
|
||||||
|
return Problem5()
|
||||||
|
elif(problemNumber == 6):
|
||||||
|
return Problem6()
|
||||||
|
elif(problemNumber == 7):
|
||||||
|
return Problem7()
|
||||||
|
elif(problemNumber == 8):
|
||||||
|
return Problem8()
|
||||||
|
elif(problemNumber == 9):
|
||||||
|
return Problem9()
|
||||||
|
elif(problemNumber == 10):
|
||||||
|
return Problem10()
|
||||||
|
elif(problemNumber == 11):
|
||||||
|
return Problem11()
|
||||||
|
elif(problemNumber == 12):
|
||||||
|
return Problem12()
|
||||||
|
elif(problemNumber == 13):
|
||||||
|
return Problem13()
|
||||||
|
elif(problemNumber == 14):
|
||||||
|
return Problem14()
|
||||||
|
elif(problemNumber == 15):
|
||||||
|
return Problem15()
|
||||||
|
elif(problemNumber == 16):
|
||||||
|
return Problem16()
|
||||||
|
elif(problemNumber == 17):
|
||||||
|
return Problem17()
|
||||||
|
elif(problemNumber == 18):
|
||||||
|
return Problem18()
|
||||||
|
elif(problemNumber == 19):
|
||||||
|
return Problem19()
|
||||||
|
elif(problemNumber == 20):
|
||||||
|
return Problem20()
|
||||||
|
elif(problemNumber == 21):
|
||||||
|
return Problem21()
|
||||||
|
elif(problemNumber == 22):
|
||||||
|
return Problem22()
|
||||||
|
elif(problemNumber == 23):
|
||||||
|
return Problem23()
|
||||||
|
elif(problemNumber == 24):
|
||||||
|
return Problem24()
|
||||||
|
elif(problemNumber == 25):
|
||||||
|
return Problem25()
|
||||||
|
elif(problemNumber == 26):
|
||||||
|
return Problem26()
|
||||||
|
elif(problemNumber == 27):
|
||||||
|
return Problem27()
|
||||||
|
elif(problemNumber == 28):
|
||||||
|
return Problem28()
|
||||||
|
elif(problemNumber == 29):
|
||||||
|
return Problem29()
|
||||||
|
elif(problemNumber == 30):
|
||||||
|
return Problem30()
|
||||||
|
elif(problemNumber == 31):
|
||||||
|
return Problem31()
|
||||||
|
elif(problemNumber == 67):
|
||||||
|
return Problem67()
|
||||||
|
|
||||||
|
#Print the description of a problem
|
||||||
|
@staticmethod
|
||||||
|
def printDescription(problemNumber: int):
|
||||||
|
#Get the problem
|
||||||
|
problem = ProblemSelection.getProblem(problemNumber)
|
||||||
|
#Print the problem's description
|
||||||
|
print(problem.getDescription())
|
||||||
|
|
||||||
|
#Solve a problem
|
||||||
|
@staticmethod
|
||||||
|
def solveProblem(problemNumber: int):
|
||||||
|
#Get the problem
|
||||||
|
problem = ProblemSelection.getProblem(problemNumber)
|
||||||
|
#Print the problem description
|
||||||
|
print(problem.getDescription())
|
||||||
|
#Solve the problem
|
||||||
|
problem.solve()
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
#Get a valid problem number from a user
|
||||||
|
@staticmethod
|
||||||
|
def getProblemNumber() -> int:
|
||||||
|
problemNumber = int(input("Enter a problem number: "))
|
||||||
|
while not (problemNumber in ProblemSelection.problemNumbers):
|
||||||
|
print("That is an invalid problem number!")
|
||||||
|
problemNumber = int(input("Enter a problem number: "))
|
||||||
|
return problemNumber
|
||||||
|
|
||||||
|
#List all valid problem numbers
|
||||||
|
@staticmethod
|
||||||
|
def listProblems():
|
||||||
|
problemList = str(ProblemSelection.problemNumbers[1])
|
||||||
|
for problemNumber in range(2, len(ProblemSelection.problemNumbers)):
|
||||||
|
problemList += ", " + str(ProblemSelection.problemNumbers[problemNumber])
|
||||||
|
print(problemList + "\n")
|
||||||
68
Problems/Problem.py
Normal file
68
Problems/Problem.py
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
#ProjectEuler/ProjectEulerPython/Problems/Problem.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 07-11-20
|
||||||
|
#Modified: 07-11-20
|
||||||
|
#This is a base class for problems to use as a template
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
import abc
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
|
class Problem(metaclass=abc.ABCMeta):
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
@abc.abstractmethod
|
||||||
|
def __init__(self, description: str):
|
||||||
|
#Instance variables
|
||||||
|
self.timer = Stopwatch()
|
||||||
|
self.result = ""
|
||||||
|
self.description = description
|
||||||
|
self.solved = False
|
||||||
|
#Gets
|
||||||
|
#Returns the description of the problem
|
||||||
|
def getDescription(self) -> str:
|
||||||
|
return self.description
|
||||||
|
#Returns the result of solving the problem
|
||||||
|
def getResult(self) -> str:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can see the result")
|
||||||
|
return self.result
|
||||||
|
#Returns the time taken to run the problem as a string
|
||||||
|
def getTime(self) -> str:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can see the time")
|
||||||
|
return self.timer.getString()
|
||||||
|
#Returns the timer as a stopwatch
|
||||||
|
def getTimer(self) -> Stopwatch:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can see the timer")
|
||||||
|
return self.timer
|
||||||
|
#Solve the problem
|
||||||
|
@abc.abstractmethod
|
||||||
|
def solve(self):
|
||||||
|
pass
|
||||||
|
def reset(self):
|
||||||
|
self.timer.reset()
|
||||||
|
self.solved = False
|
||||||
|
self.result = ""
|
||||||
93
Problems/Problem1.py
Normal file
93
Problems/Problem1.py
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
#ProjectEuler/Python/Problem1.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 01-26-19
|
||||||
|
#Modified: 07-17-20
|
||||||
|
#What is the sum of all the multiples of 3 or 5 that are less than 1000
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
|
class Problem1(Problem):
|
||||||
|
#Variables
|
||||||
|
__topNum = 999 #The largest number to be checked
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("What is the sum of all the multiples of 3 or 5 that are less than 1000")
|
||||||
|
self.fullSum = 0 #The sum of all the numbers
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Check every number < 1000 to see if it is a multiple of 3 or 5. If it is add it to the running sum
|
||||||
|
#Add one to topNum because range works on < instead of <=
|
||||||
|
for num in range(1, self.__topNum + 1):
|
||||||
|
if((num % 3) == 0):
|
||||||
|
self.fullSum += num
|
||||||
|
elif((num % 5) == 0):
|
||||||
|
self.fullSum += num
|
||||||
|
num += 1
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The sum of all number < " + str(self.__topNum + 1) + " is " + str(self.fullSum)
|
||||||
|
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.fullSum = 0
|
||||||
|
#Gets
|
||||||
|
#Returns the requested sum
|
||||||
|
def getSum(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the sum")
|
||||||
|
return self.fullSum
|
||||||
|
|
||||||
|
|
||||||
|
#If you are running this file, automatically start the correct function
|
||||||
|
if(__name__ == "__main__"):
|
||||||
|
problem = Problem1()
|
||||||
|
print(problem.getDescription()) #Print the description
|
||||||
|
problem.solve() #Call the function that answers the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
"""Results:
|
||||||
|
The sum of all the multiples of 3 or 5 is 233168
|
||||||
|
It took 114.142 microseconds to run this algorithm
|
||||||
|
"""
|
||||||
90
Problems/Problem10.py
Normal file
90
Problems/Problem10.py
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
#Project Euler/Python/Problem10.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 01-30-19
|
||||||
|
#Modified: 07-18-20
|
||||||
|
#Find the sum of all the primes below two million
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
from Algorithms import getPrimes
|
||||||
|
|
||||||
|
|
||||||
|
class Problem10(Problem):
|
||||||
|
#Variables
|
||||||
|
__numberGreaterThanPrimes = 2000000 - 1 #Get all primes < this number
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("Find the sum of all the primes below two million")
|
||||||
|
self.sum = 0 #The sum of all of the prime numbers
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the function
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Get all of the primes < 2000000
|
||||||
|
primes = getPrimes(self.__numberGreaterThanPrimes)
|
||||||
|
#Get the sum of the list
|
||||||
|
self.sum = sum(primes)
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The sum of all the prime numbers less than " + str(self.__numberGreaterThanPrimes + 1) + " is " + str(self.sum)
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.sum = 0
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the sum that was requested
|
||||||
|
def getSum(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the sum")
|
||||||
|
return self.sum
|
||||||
|
|
||||||
|
|
||||||
|
#If you are running this file, automatically start the correct function
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem10()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
"""Results:
|
||||||
|
The sum of all the prime numbers less than 2000000 is 142913828922
|
||||||
|
It took 5.926 seconds to run this algorithm
|
||||||
|
"""
|
||||||
192
Problems/Problem11.py
Normal file
192
Problems/Problem11.py
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
#ProjectEuler/Python/Problem11.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 01-31-19
|
||||||
|
#Modified: 07-18-20
|
||||||
|
#What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid?
|
||||||
|
"""
|
||||||
|
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
|
||||||
|
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
|
||||||
|
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
|
||||||
|
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91
|
||||||
|
22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80
|
||||||
|
24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50
|
||||||
|
32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70
|
||||||
|
67 26 20 68 02 62 12 20 95 63 94 39 63 08 40 91 66 49 94 21
|
||||||
|
24 55 58 05 66 73 99 26 97 17 78 78 96 83 14 88 34 89 63 72
|
||||||
|
21 36 23 09 75 00 76 44 20 45 35 14 00 61 33 97 34 31 33 95
|
||||||
|
78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92
|
||||||
|
16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57
|
||||||
|
86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58
|
||||||
|
19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40
|
||||||
|
04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66
|
||||||
|
88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69
|
||||||
|
04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36
|
||||||
|
20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16
|
||||||
|
20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54
|
||||||
|
01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48
|
||||||
|
"""
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
from Algorithms import prod
|
||||||
|
|
||||||
|
|
||||||
|
class Problem11(Problem):
|
||||||
|
#Variables
|
||||||
|
__grid = [[8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8],
|
||||||
|
[49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 00],
|
||||||
|
[81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65],
|
||||||
|
[52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, 56, 71, 37, 2, 36, 91],
|
||||||
|
[22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80],
|
||||||
|
[24, 47, 32, 60, 99, 3, 45, 2, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50],
|
||||||
|
[32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70],
|
||||||
|
[67, 26, 20, 68, 2, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21],
|
||||||
|
[24, 55, 58, 5, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, 72],
|
||||||
|
[21, 36, 23, 9, 75, 0, 76, 44, 20, 45, 35, 14, 0, 61, 33, 97, 34, 31, 33, 95],
|
||||||
|
[78, 17, 53, 28, 22, 75, 31, 67, 15, 94, 3, 80, 4, 62, 16, 14, 9, 53, 56, 92],
|
||||||
|
[16, 39, 5, 42, 96, 35, 31, 47, 55, 58, 88, 24, 0, 17, 54, 24, 36, 29, 85, 57],
|
||||||
|
[86, 56, 0, 48, 35, 71, 89, 7, 5, 44, 44, 37, 44, 60, 21, 58, 51, 54, 17, 58],
|
||||||
|
[19, 80, 81, 68, 5, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 4, 89, 55, 40],
|
||||||
|
[ 4, 52, 8, 83, 97, 35, 99, 16, 7, 97, 57, 32, 16, 26, 26, 79, 33, 27, 98, 66],
|
||||||
|
[88, 36, 68, 87, 57, 62, 20, 72, 3, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, 69],
|
||||||
|
[ 4, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36],
|
||||||
|
[20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 4, 36, 16],
|
||||||
|
[20, 73, 35, 29, 78, 31, 90, 1, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 5, 54],
|
||||||
|
[ 1, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 1, 89, 19, 67, 48]]
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid?")
|
||||||
|
self.greatestProduct = []
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Setup the variables
|
||||||
|
self.greatestProduct = [0, 0, 0, 0] #Holds the numbers that give the greatest product
|
||||||
|
currentNumbers = [0, 0, 0, 0] #Holds the numbers that you are currently working with
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Loop through every location in the grid
|
||||||
|
for row in range(0, len(self.__grid)):
|
||||||
|
for col in range (0, len(self.__grid[row])):
|
||||||
|
#Setup variables for knowing what direction you can move
|
||||||
|
moveLeft = False
|
||||||
|
moveRight = False
|
||||||
|
moveDown = False
|
||||||
|
|
||||||
|
#Check which directions you will be able to move
|
||||||
|
if((col - 3) >= 0):
|
||||||
|
moveLeft = True
|
||||||
|
if((col + 3) < len(self.__grid[row])):
|
||||||
|
moveRight = True
|
||||||
|
if((row + 3) < 20):
|
||||||
|
moveDown = True
|
||||||
|
|
||||||
|
#With these movements check for the greatest product of 4 adjacent numebrs
|
||||||
|
#Move Right
|
||||||
|
if moveRight:
|
||||||
|
currentNumbers[0] = self.__grid[row][col]
|
||||||
|
currentNumbers[1] = self.__grid[row][col + 1]
|
||||||
|
currentNumbers[2] = self.__grid[row][col + 2]
|
||||||
|
currentNumbers[3] = self.__grid[row][col + 3]
|
||||||
|
|
||||||
|
if(prod(currentNumbers) > prod(self.greatestProduct)):
|
||||||
|
self.greatestProduct = currentNumbers.copy()
|
||||||
|
|
||||||
|
#Move Down
|
||||||
|
if moveDown:
|
||||||
|
currentNumbers[0] = self.__grid[row][col]
|
||||||
|
currentNumbers[1] = self.__grid[row + 1][col]
|
||||||
|
currentNumbers[2] = self.__grid[row + 2][col]
|
||||||
|
currentNumbers[3] = self.__grid[row + 3][col]
|
||||||
|
|
||||||
|
if(prod(currentNumbers) > prod(self.greatestProduct)):
|
||||||
|
self.greatestProduct = currentNumbers.copy()
|
||||||
|
|
||||||
|
#Move Down & Left
|
||||||
|
if(moveDown and moveLeft):
|
||||||
|
currentNumbers[0] = self.__grid[row][col]
|
||||||
|
currentNumbers[1] = self.__grid[row + 1][col - 1]
|
||||||
|
currentNumbers[2] = self.__grid[row + 2][col - 2]
|
||||||
|
currentNumbers[3] = self.__grid[row + 3][col - 3]
|
||||||
|
|
||||||
|
if(prod(currentNumbers) > prod(self.greatestProduct)):
|
||||||
|
self.greatestProduct = currentNumbers.copy()
|
||||||
|
|
||||||
|
#Move Down & Right
|
||||||
|
if(moveDown and moveRight):
|
||||||
|
currentNumbers[0] = self.__grid[row][col]
|
||||||
|
currentNumbers[1] = self.__grid[row + 1][col + 1]
|
||||||
|
currentNumbers[2] = self.__grid[row + 2][col + 2]
|
||||||
|
currentNumbers[3] = self.__grid[row + 3][col + 3]
|
||||||
|
|
||||||
|
if(prod(currentNumbers) > prod(self.greatestProduct)):
|
||||||
|
self.greatestProduct = currentNumbers.copy()
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The greatest product of 3 numbers in a line is " + str(prod(self.greatestProduct))
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.greatestProduct.clear()
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the numbers that were being searched
|
||||||
|
def getNumbers(self) -> list:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the numbers being searched")
|
||||||
|
return self.greatestProduct
|
||||||
|
#Returns the product that was requested
|
||||||
|
def getProduct(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the product")
|
||||||
|
return prod(self.greatestProduct)
|
||||||
|
|
||||||
|
#If you are running this file, automatically start the correct function
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem11()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
"""Results:
|
||||||
|
The greatest product of 3 numbers in a line is 70600674
|
||||||
|
It took 1.162 milliseconds to run this algorithm
|
||||||
|
"""
|
||||||
119
Problems/Problem12.py
Normal file
119
Problems/Problem12.py
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
#ProjectEuler/Python/Problem12.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 01-31-19
|
||||||
|
#Modified: 07-18-20
|
||||||
|
#What is the value of the first triangle number to have over five hundred divisors?
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
from Algorithms import getDivisors
|
||||||
|
|
||||||
|
|
||||||
|
class Problem12(Problem):
|
||||||
|
#Variables
|
||||||
|
__goalDivisors = 500 #The number of divisors a number needs to reach
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("What is the value of the first triangle number to have over five hundred divisors?")
|
||||||
|
self.sum = 1
|
||||||
|
self.counter = 2
|
||||||
|
self.divisors = []
|
||||||
|
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Start at the first triangular number and loop around, moving to the next, until you find one with the appropriate number of divisors
|
||||||
|
foundNumber = False #A flag for when the triangular number has over __goalDivisors divisors
|
||||||
|
while((not foundNumber) and (self.sum > 0)): #Make sure you haven't caused an overflow and made trianularNumber negative
|
||||||
|
#See how many divisors this triangular number has
|
||||||
|
self.divisors = getDivisors(self.sum)
|
||||||
|
#If it did have enough raise a flag to stop the loop
|
||||||
|
if(len(self.divisors) > self.__goalDivisors):
|
||||||
|
foundNumber = True
|
||||||
|
else:
|
||||||
|
self.sum += self.counter #Add the next number to continue the triangular sequence
|
||||||
|
self.counter += 1 #Advance to the next number in the triangular sequence
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
if(self.sum <= 0):
|
||||||
|
self.result = "There was an error. Could not find a triangular number with " + str(self.__goalDivisors) + " divisors before overflow"
|
||||||
|
else:
|
||||||
|
self.result = "The first triangular number with more than " + str(self.__goalDivisors) + " divisors is " + str(self.sum)
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.sum = 1
|
||||||
|
self.counter = 2
|
||||||
|
self.divisors.clear()
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the triangular number
|
||||||
|
def getTriangularNumber(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the triangular number")
|
||||||
|
return self.sum
|
||||||
|
#Gets the final number that was added to the triangular number
|
||||||
|
def getLastNumberAdded(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the last number added to the triangular number")
|
||||||
|
return self.counter - 1
|
||||||
|
#Returns the list of divisors of the requested number
|
||||||
|
def getDivisorsOfTriangularNumber(self) -> list:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the divisors of the triangular number")
|
||||||
|
return self.divisors
|
||||||
|
#Returns the number of divisors of the requested number
|
||||||
|
def getNumberOfDivisors(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the number of divisors")
|
||||||
|
return len(self.divisors)
|
||||||
|
|
||||||
|
#If you are running this file, automatically start the correct function
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem12()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
"""Results:
|
||||||
|
The first triangular number with more than 500 divisors is 76576500
|
||||||
|
It took 2.898 seconds to run this algorithm
|
||||||
|
"""
|
||||||
294
Problems/Problem13.py
Normal file
294
Problems/Problem13.py
Normal file
@@ -0,0 +1,294 @@
|
|||||||
|
#ProjectEuler/Python/Problem13.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 01-31-19
|
||||||
|
#Modified: 07-17-20
|
||||||
|
#Work out the first ten digits of the sum of the following one-hundred 50-digit numbers
|
||||||
|
"""
|
||||||
|
37107287533902102798797998220837590246510135740250
|
||||||
|
46376937677490009712648124896970078050417018260538
|
||||||
|
74324986199524741059474233309513058123726617309629
|
||||||
|
91942213363574161572522430563301811072406154908250
|
||||||
|
23067588207539346171171980310421047513778063246676
|
||||||
|
89261670696623633820136378418383684178734361726757
|
||||||
|
28112879812849979408065481931592621691275889832738
|
||||||
|
44274228917432520321923589422876796487670272189318
|
||||||
|
47451445736001306439091167216856844588711603153276
|
||||||
|
70386486105843025439939619828917593665686757934951
|
||||||
|
62176457141856560629502157223196586755079324193331
|
||||||
|
64906352462741904929101432445813822663347944758178
|
||||||
|
92575867718337217661963751590579239728245598838407
|
||||||
|
58203565325359399008402633568948830189458628227828
|
||||||
|
80181199384826282014278194139940567587151170094390
|
||||||
|
35398664372827112653829987240784473053190104293586
|
||||||
|
86515506006295864861532075273371959191420517255829
|
||||||
|
71693888707715466499115593487603532921714970056938
|
||||||
|
54370070576826684624621495650076471787294438377604
|
||||||
|
53282654108756828443191190634694037855217779295145
|
||||||
|
36123272525000296071075082563815656710885258350721
|
||||||
|
45876576172410976447339110607218265236877223636045
|
||||||
|
17423706905851860660448207621209813287860733969412
|
||||||
|
81142660418086830619328460811191061556940512689692
|
||||||
|
51934325451728388641918047049293215058642563049483
|
||||||
|
62467221648435076201727918039944693004732956340691
|
||||||
|
15732444386908125794514089057706229429197107928209
|
||||||
|
55037687525678773091862540744969844508330393682126
|
||||||
|
18336384825330154686196124348767681297534375946515
|
||||||
|
80386287592878490201521685554828717201219257766954
|
||||||
|
78182833757993103614740356856449095527097864797581
|
||||||
|
16726320100436897842553539920931837441497806860984
|
||||||
|
48403098129077791799088218795327364475675590848030
|
||||||
|
87086987551392711854517078544161852424320693150332
|
||||||
|
59959406895756536782107074926966537676326235447210
|
||||||
|
69793950679652694742597709739166693763042633987085
|
||||||
|
41052684708299085211399427365734116182760315001271
|
||||||
|
65378607361501080857009149939512557028198746004375
|
||||||
|
35829035317434717326932123578154982629742552737307
|
||||||
|
94953759765105305946966067683156574377167401875275
|
||||||
|
88902802571733229619176668713819931811048770190271
|
||||||
|
25267680276078003013678680992525463401061632866526
|
||||||
|
36270218540497705585629946580636237993140746255962
|
||||||
|
24074486908231174977792365466257246923322810917141
|
||||||
|
91430288197103288597806669760892938638285025333403
|
||||||
|
34413065578016127815921815005561868836468420090470
|
||||||
|
23053081172816430487623791969842487255036638784583
|
||||||
|
11487696932154902810424020138335124462181441773470
|
||||||
|
63783299490636259666498587618221225225512486764533
|
||||||
|
67720186971698544312419572409913959008952310058822
|
||||||
|
95548255300263520781532296796249481641953868218774
|
||||||
|
76085327132285723110424803456124867697064507995236
|
||||||
|
37774242535411291684276865538926205024910326572967
|
||||||
|
23701913275725675285653248258265463092207058596522
|
||||||
|
29798860272258331913126375147341994889534765745501
|
||||||
|
18495701454879288984856827726077713721403798879715
|
||||||
|
38298203783031473527721580348144513491373226651381
|
||||||
|
34829543829199918180278916522431027392251122869539
|
||||||
|
40957953066405232632538044100059654939159879593635
|
||||||
|
29746152185502371307642255121183693803580388584903
|
||||||
|
41698116222072977186158236678424689157993532961922
|
||||||
|
62467957194401269043877107275048102390895523597457
|
||||||
|
23189706772547915061505504953922979530901129967519
|
||||||
|
86188088225875314529584099251203829009407770775672
|
||||||
|
11306739708304724483816533873502340845647058077308
|
||||||
|
82959174767140363198008187129011875491310547126581
|
||||||
|
97623331044818386269515456334926366572897563400500
|
||||||
|
42846280183517070527831839425882145521227251250327
|
||||||
|
55121603546981200581762165212827652751691296897789
|
||||||
|
32238195734329339946437501907836945765883352399886
|
||||||
|
75506164965184775180738168837861091527357929701337
|
||||||
|
62177842752192623401942399639168044983993173312731
|
||||||
|
32924185707147349566916674687634660915035914677504
|
||||||
|
99518671430235219628894890102423325116913619626622
|
||||||
|
73267460800591547471830798392868535206946944540724
|
||||||
|
76841822524674417161514036427982273348055556214818
|
||||||
|
97142617910342598647204516893989422179826088076852
|
||||||
|
87783646182799346313767754307809363333018982642090
|
||||||
|
10848802521674670883215120185883543223812876952786
|
||||||
|
71329612474782464538636993009049310363619763878039
|
||||||
|
62184073572399794223406235393808339651327408011116
|
||||||
|
66627891981488087797941876876144230030984490851411
|
||||||
|
60661826293682836764744779239180335110989069790714
|
||||||
|
85786944089552990653640447425576083659976645795096
|
||||||
|
66024396409905389607120198219976047599490197230297
|
||||||
|
64913982680032973156037120041377903785566085089252
|
||||||
|
16730939319872750275468906903707539413042652315011
|
||||||
|
94809377245048795150954100921645863754710598436791
|
||||||
|
78639167021187492431995700641917969777599028300699
|
||||||
|
15368713711936614952811305876380278410754449733078
|
||||||
|
40789923115535562561142322423255033685442488917353
|
||||||
|
44889911501440648020369068063960672322193204149535
|
||||||
|
41503128880339536053299340368006977710650566631954
|
||||||
|
81234880673210146739058568557934581403627822703280
|
||||||
|
82616570773948327592232845941706525094512325230608
|
||||||
|
22918802058777319719839450180888072429661980811197
|
||||||
|
77158542502016545090413245809786882778948721859617
|
||||||
|
72107838435069186155435662884062257473692284509516
|
||||||
|
20849603980134001723930671666823555245252804609722
|
||||||
|
53503534226472524250874054075591789781264330331690
|
||||||
|
"""
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
|
class Problem13(Problem):
|
||||||
|
#The numbers that need to be summed
|
||||||
|
__numbers = [37107287533902102798797998220837590246510135740250,
|
||||||
|
46376937677490009712648124896970078050417018260538,
|
||||||
|
74324986199524741059474233309513058123726617309629,
|
||||||
|
91942213363574161572522430563301811072406154908250,
|
||||||
|
23067588207539346171171980310421047513778063246676,
|
||||||
|
89261670696623633820136378418383684178734361726757,
|
||||||
|
28112879812849979408065481931592621691275889832738,
|
||||||
|
44274228917432520321923589422876796487670272189318,
|
||||||
|
47451445736001306439091167216856844588711603153276,
|
||||||
|
70386486105843025439939619828917593665686757934951,
|
||||||
|
62176457141856560629502157223196586755079324193331,
|
||||||
|
64906352462741904929101432445813822663347944758178,
|
||||||
|
92575867718337217661963751590579239728245598838407,
|
||||||
|
58203565325359399008402633568948830189458628227828,
|
||||||
|
80181199384826282014278194139940567587151170094390,
|
||||||
|
35398664372827112653829987240784473053190104293586,
|
||||||
|
86515506006295864861532075273371959191420517255829,
|
||||||
|
71693888707715466499115593487603532921714970056938,
|
||||||
|
54370070576826684624621495650076471787294438377604,
|
||||||
|
53282654108756828443191190634694037855217779295145,
|
||||||
|
36123272525000296071075082563815656710885258350721,
|
||||||
|
45876576172410976447339110607218265236877223636045,
|
||||||
|
17423706905851860660448207621209813287860733969412,
|
||||||
|
81142660418086830619328460811191061556940512689692,
|
||||||
|
51934325451728388641918047049293215058642563049483,
|
||||||
|
62467221648435076201727918039944693004732956340691,
|
||||||
|
15732444386908125794514089057706229429197107928209,
|
||||||
|
55037687525678773091862540744969844508330393682126,
|
||||||
|
18336384825330154686196124348767681297534375946515,
|
||||||
|
80386287592878490201521685554828717201219257766954,
|
||||||
|
78182833757993103614740356856449095527097864797581,
|
||||||
|
16726320100436897842553539920931837441497806860984,
|
||||||
|
48403098129077791799088218795327364475675590848030,
|
||||||
|
87086987551392711854517078544161852424320693150332,
|
||||||
|
59959406895756536782107074926966537676326235447210,
|
||||||
|
69793950679652694742597709739166693763042633987085,
|
||||||
|
41052684708299085211399427365734116182760315001271,
|
||||||
|
65378607361501080857009149939512557028198746004375,
|
||||||
|
35829035317434717326932123578154982629742552737307,
|
||||||
|
94953759765105305946966067683156574377167401875275,
|
||||||
|
88902802571733229619176668713819931811048770190271,
|
||||||
|
25267680276078003013678680992525463401061632866526,
|
||||||
|
36270218540497705585629946580636237993140746255962,
|
||||||
|
24074486908231174977792365466257246923322810917141,
|
||||||
|
91430288197103288597806669760892938638285025333403,
|
||||||
|
34413065578016127815921815005561868836468420090470,
|
||||||
|
23053081172816430487623791969842487255036638784583,
|
||||||
|
11487696932154902810424020138335124462181441773470,
|
||||||
|
63783299490636259666498587618221225225512486764533,
|
||||||
|
67720186971698544312419572409913959008952310058822,
|
||||||
|
95548255300263520781532296796249481641953868218774,
|
||||||
|
76085327132285723110424803456124867697064507995236,
|
||||||
|
37774242535411291684276865538926205024910326572967,
|
||||||
|
23701913275725675285653248258265463092207058596522,
|
||||||
|
29798860272258331913126375147341994889534765745501,
|
||||||
|
18495701454879288984856827726077713721403798879715,
|
||||||
|
38298203783031473527721580348144513491373226651381,
|
||||||
|
34829543829199918180278916522431027392251122869539,
|
||||||
|
40957953066405232632538044100059654939159879593635,
|
||||||
|
29746152185502371307642255121183693803580388584903,
|
||||||
|
41698116222072977186158236678424689157993532961922,
|
||||||
|
62467957194401269043877107275048102390895523597457,
|
||||||
|
23189706772547915061505504953922979530901129967519,
|
||||||
|
86188088225875314529584099251203829009407770775672,
|
||||||
|
11306739708304724483816533873502340845647058077308,
|
||||||
|
82959174767140363198008187129011875491310547126581,
|
||||||
|
97623331044818386269515456334926366572897563400500,
|
||||||
|
42846280183517070527831839425882145521227251250327,
|
||||||
|
55121603546981200581762165212827652751691296897789,
|
||||||
|
32238195734329339946437501907836945765883352399886,
|
||||||
|
75506164965184775180738168837861091527357929701337,
|
||||||
|
62177842752192623401942399639168044983993173312731,
|
||||||
|
32924185707147349566916674687634660915035914677504,
|
||||||
|
99518671430235219628894890102423325116913619626622,
|
||||||
|
73267460800591547471830798392868535206946944540724,
|
||||||
|
76841822524674417161514036427982273348055556214818,
|
||||||
|
97142617910342598647204516893989422179826088076852,
|
||||||
|
87783646182799346313767754307809363333018982642090,
|
||||||
|
10848802521674670883215120185883543223812876952786,
|
||||||
|
71329612474782464538636993009049310363619763878039,
|
||||||
|
62184073572399794223406235393808339651327408011116,
|
||||||
|
66627891981488087797941876876144230030984490851411,
|
||||||
|
60661826293682836764744779239180335110989069790714,
|
||||||
|
85786944089552990653640447425576083659976645795096,
|
||||||
|
66024396409905389607120198219976047599490197230297,
|
||||||
|
64913982680032973156037120041377903785566085089252,
|
||||||
|
16730939319872750275468906903707539413042652315011,
|
||||||
|
94809377245048795150954100921645863754710598436791,
|
||||||
|
78639167021187492431995700641917969777599028300699,
|
||||||
|
15368713711936614952811305876380278410754449733078,
|
||||||
|
40789923115535562561142322423255033685442488917353,
|
||||||
|
44889911501440648020369068063960672322193204149535,
|
||||||
|
41503128880339536053299340368006977710650566631954,
|
||||||
|
81234880673210146739058568557934581403627822703280,
|
||||||
|
82616570773948327592232845941706525094512325230608,
|
||||||
|
22918802058777319719839450180888072429661980811197,
|
||||||
|
77158542502016545090413245809786882778948721859617,
|
||||||
|
72107838435069186155435662884062257473692284509516,
|
||||||
|
20849603980134001723930671666823555245252804609722,
|
||||||
|
53503534226472524250874054075591789781264330331690]
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("Work out the first ten digits of the sum of the one-hundred 50-digit numbers")
|
||||||
|
self.sum = 0
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Get the sum of all of the numbers in the list
|
||||||
|
self.sum = sum(self.__numbers)
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The sum of all " + str(len(self.__numbers)) + " numbers is " + str(self.sum) + "\nThe first 10 digits are: " + str(self.sum)[0:10]
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
sum = 0
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the list of 50-digit numbers
|
||||||
|
def getNumbers(self) -> list:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the numbers")
|
||||||
|
return self.__numbers
|
||||||
|
#Returns the sum of the 50-digit numbers
|
||||||
|
def getSum(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the sum of the numbers")
|
||||||
|
return self.sum
|
||||||
|
|
||||||
|
#If you are running this file, automatically start the correct function
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem13()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
"""Results:
|
||||||
|
The sum of all 100 numbers is 5537376230390876637302048746832985971773659831892672
|
||||||
|
The first 10 digits are: 5537376230
|
||||||
|
It took 23.015 microseconds to run this algorithm
|
||||||
|
"""
|
||||||
117
Problems/Problem14.py
Normal file
117
Problems/Problem14.py
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
#ProjectEuler/Python/Problem14.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 01-31-19
|
||||||
|
#Modified: 07-18-20
|
||||||
|
"""
|
||||||
|
The following iterative sequence is defined for the set of positive integers:
|
||||||
|
n → n/2 (n is even)
|
||||||
|
n → 3n + 1 (n is odd)
|
||||||
|
Which starting number, under one million, produces the longest chain?
|
||||||
|
"""
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
|
class Problem14(Problem):
|
||||||
|
#Variables
|
||||||
|
__topNum = 1000000 - 1 #The largest number that you will check against the chain
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("Which starting number, under one million, produces the longest chain using the itterative sequence?")
|
||||||
|
self.maxLength = 0
|
||||||
|
self.maxNum = 0
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Loop through all number <= topNum and check them against the series
|
||||||
|
for currentNum in range(1, self.__topNum + 1):
|
||||||
|
currentLength = self.checkSeries(currentNum)
|
||||||
|
#If the current number has a longer series than the max then the current becomes the max
|
||||||
|
if(currentLength > self.maxLength):
|
||||||
|
self.maxLength = currentLength
|
||||||
|
self.maxNum = currentNum
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The number " + str(self.maxNum) + " produced a chain of " + str(self.maxLength) + " steps"
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#This function follows the rules of the sequence and returns its length
|
||||||
|
def checkSeries(self, num: int) -> int:
|
||||||
|
length = 1 #Start at 1 because you need to count the starting number
|
||||||
|
|
||||||
|
#Follow the series, adding 1 for each step you take
|
||||||
|
while(num > 1):
|
||||||
|
if((num % 2) == 0):
|
||||||
|
num = num / 2
|
||||||
|
else:
|
||||||
|
num = (3 * num) + 1
|
||||||
|
length += 1
|
||||||
|
|
||||||
|
return length
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.maxLength = 0
|
||||||
|
self.maxNum = 0
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the length of the requested chain
|
||||||
|
def getLength(self):
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the length of the requested chain")
|
||||||
|
return self.maxLength
|
||||||
|
#Returns the starting number of the requested chain
|
||||||
|
def getStartingNumber(self):
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the number that started the series")
|
||||||
|
return self.maxNum
|
||||||
|
|
||||||
|
#If you are running this file, automatically start the correct function
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem14()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
"""Results:
|
||||||
|
The longest chain with a starting number < 1000000 is 837799 with a length of 525
|
||||||
|
It took 28.893 seconds to run this algorithm
|
||||||
|
"""
|
||||||
105
Problems/Problem15.py
Normal file
105
Problems/Problem15.py
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
#ProjectEuler/Python/Problem15.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 01-31-19
|
||||||
|
#Modified: 07-18-20
|
||||||
|
#How many routes from the top left corner to the bottom right corner are there through a 20×20 grid if you can only move right and down?
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
#There must be a better way than this. This is untested. I let it run for about 14 hours and it still hadn't spit an answer out for me
|
||||||
|
#But it is programed exactly as I programmed the C++ solution, so the eventual answer should be correct
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
|
class Problem15(Problem):
|
||||||
|
#Variables
|
||||||
|
__gridWidth = 20 #The height of the grid
|
||||||
|
__gridHeight = 20 #The width of the grid
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("How many routes from the top left corner to the bottom right corner are there through a 20x20 grid if you can only move right and down?")
|
||||||
|
self.numOfRoutes = 0
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Start the recursion at the right location and catch what is returned
|
||||||
|
numberMoves = self.movement(0, 0)
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Print the results
|
||||||
|
self.result = "The number of paths from 1 corner of a " + str(self.__gridWidth) + " x " + str(self.__gridHeight) + " grid to the opposite corner is " + str(numberMoves)
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#This function acts as a handler for moving the position on the grid and counting the distance
|
||||||
|
#It moves right first, then down
|
||||||
|
def movement(self, currentX: int, currentY: int) -> int:
|
||||||
|
#Return 1 if you are at the finish location
|
||||||
|
if((currentX == self.__gridWidth) and (currentY == self.__gridHeight)):
|
||||||
|
return 1
|
||||||
|
|
||||||
|
numberMoves = 0
|
||||||
|
#Otherwise move one right if you can and recurse
|
||||||
|
if(currentX < self.__gridWidth):
|
||||||
|
numberMoves = self.movement(currentX + 1, currentY)
|
||||||
|
|
||||||
|
#Then move one down and recurse
|
||||||
|
if(currentY < self.__gridHeight):
|
||||||
|
numberMoves += self.movement(currentX, currentY + 1)
|
||||||
|
|
||||||
|
return numberMoves
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.numOfRoutes = 0
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the number of routes found
|
||||||
|
def getNumberOfRoutes(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the number of routes")
|
||||||
|
return self.numOfRoutes
|
||||||
|
|
||||||
|
#If you are running this file, automatically start the correct function
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem15()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
"""Results:
|
||||||
|
|
||||||
|
"""
|
||||||
103
Problems/Problem16.py
Normal file
103
Problems/Problem16.py
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
#Project Euler/Python/Problem16.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 02-03-19
|
||||||
|
#Modified: 03-28-19
|
||||||
|
#What is the sum of the digits of the number 2^1000?
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2019 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
|
class Problem16(Problem):
|
||||||
|
#Variables
|
||||||
|
__numToPower = 2 #The number that is going to be raised to a power
|
||||||
|
__power = 1000 #The power that the number is going to be raised to
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("What is the sum of the digits of the number 2^1000?")
|
||||||
|
self.num = 0
|
||||||
|
self.sumOfElements = 0
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Get the number
|
||||||
|
self.num = self.__numToPower ** self.__power
|
||||||
|
#Change the number to a string
|
||||||
|
stringOfNum = str(self.num)
|
||||||
|
#Step through the string one element at a time
|
||||||
|
for cnt in range(0, len(stringOfNum)):
|
||||||
|
#Change the character to an int and add it to the sum
|
||||||
|
self.sumOfElements += int(stringOfNum[cnt])
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the result
|
||||||
|
self.result = str(self.__numToPower) + "^" + str(self.__power) + " = " + stringOfNum + "\nThe sum of the elements is " + str(self.sumOfElements)
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.num = 0
|
||||||
|
self.sumOfElements = 0
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the number that was calculated
|
||||||
|
def getNumber(self):
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the number")
|
||||||
|
return self.num
|
||||||
|
#Return the sum of digits of the number
|
||||||
|
def getSum(self):
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the sum of the digits of the number")
|
||||||
|
return self.sumOfElements
|
||||||
|
|
||||||
|
#If you are running this file, automatically start the correct function
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem16()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
|
||||||
|
"""Results:
|
||||||
|
2^1000 = 10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376
|
||||||
|
The sum of the digits is: 1366
|
||||||
|
It took 86.206 microseconds to run this algorithm
|
||||||
|
"""
|
||||||
208
Problems/Problem17.py
Normal file
208
Problems/Problem17.py
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
#ProjectEuler/Python/Problem17.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 02-04-19
|
||||||
|
#Modified: 07-18-20
|
||||||
|
#If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used?
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
import math
|
||||||
|
|
||||||
|
|
||||||
|
class Problem17(Problem):
|
||||||
|
__startNum = 1 #This is the smallest number to get the words of
|
||||||
|
__stopNum = 1000 #This is the largest number to get the words of
|
||||||
|
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("If all the numbers from 1 (one) to 1000 (one thousand) inclusive were written out in words, how many letters would be used?")
|
||||||
|
self.letterCount = 0
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Start with 1 and increment
|
||||||
|
for num in range(self.__startNum, self.__stopNum + 1):
|
||||||
|
#Pass the number to a function that will create a string for the number
|
||||||
|
currentNumString = self.getStringFromNum(num)
|
||||||
|
#Pass the string to a function that will count the number of letters in a string, ignoring whitespace and punctuation and add the amount to the running tally
|
||||||
|
self.letterCount += self.getNumberChars(currentNumString)
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The sum of all the letters in all the numbers " + str(self.__startNum) + '-' + str(self.__stopNum) + " is " + str(self.letterCount)
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
|
||||||
|
#This function only works for numbers -1,000,000 < num < 1,000,000
|
||||||
|
def getStringFromNum(self, number: int) -> str:
|
||||||
|
numberString = ""
|
||||||
|
#Starting with the largest digit create a string based on the number passed in
|
||||||
|
#Check for negative
|
||||||
|
if(number < 0):
|
||||||
|
numberString += "negative "
|
||||||
|
|
||||||
|
#Check if the number is zero
|
||||||
|
if(number == 0):
|
||||||
|
numberString += "zero"
|
||||||
|
|
||||||
|
#Start with the thousands place
|
||||||
|
if((number / 1000) >= 1):
|
||||||
|
numberString += self.getStringFromNum(math.floor(number / 1000))
|
||||||
|
numberString += " thousand"
|
||||||
|
number -= (math.floor(number / 1000) * 1000)
|
||||||
|
|
||||||
|
#Check for hundreds place
|
||||||
|
if((number / 100) >= 1):
|
||||||
|
numberString += self.getStringFromNum(math.floor(number / 100))
|
||||||
|
numberString += " hundred"
|
||||||
|
number -= (math.floor(number / 100) * 100)
|
||||||
|
|
||||||
|
#Insert an and if there is need
|
||||||
|
if((numberString != "") and (number > 0)):
|
||||||
|
numberString += " and "
|
||||||
|
|
||||||
|
#Check for tens place
|
||||||
|
if((number / 10) >= 2):
|
||||||
|
#For the tens you need to do something special
|
||||||
|
tensPlace = math.floor(number / 10)
|
||||||
|
if(tensPlace == 9):
|
||||||
|
numberString += "ninety"
|
||||||
|
elif(tensPlace == 8):
|
||||||
|
numberString += "eighty"
|
||||||
|
elif(tensPlace == 7):
|
||||||
|
numberString += "seventy"
|
||||||
|
elif(tensPlace == 6):
|
||||||
|
numberString += "sixty"
|
||||||
|
elif(tensPlace == 5):
|
||||||
|
numberString += "fifty"
|
||||||
|
elif(tensPlace == 4):
|
||||||
|
numberString += "forty"
|
||||||
|
elif(tensPlace == 3):
|
||||||
|
numberString += "thirty"
|
||||||
|
elif(tensPlace == 2):
|
||||||
|
numberString += "twenty"
|
||||||
|
number -= (tensPlace * 10)
|
||||||
|
#If there is something left in the number you will need a space to separate it
|
||||||
|
if(number > 0):
|
||||||
|
numberString += ' '
|
||||||
|
#Check for teens
|
||||||
|
elif((number / 10) >= 1):
|
||||||
|
onesPlace = (number % 10)
|
||||||
|
if(onesPlace == 9):
|
||||||
|
numberString += "nineteen"
|
||||||
|
elif(onesPlace == 8):
|
||||||
|
numberString += "eighteen"
|
||||||
|
elif(onesPlace == 7):
|
||||||
|
numberString += "seventeen"
|
||||||
|
elif(onesPlace == 6):
|
||||||
|
numberString += "sixteen"
|
||||||
|
elif(onesPlace == 5):
|
||||||
|
numberString += "fifteen"
|
||||||
|
elif(onesPlace == 4):
|
||||||
|
numberString += "fourteen"
|
||||||
|
elif(onesPlace == 3):
|
||||||
|
numberString += "thirteen"
|
||||||
|
elif(onesPlace == 2):
|
||||||
|
numberString += "twelve"
|
||||||
|
elif(onesPlace == 1):
|
||||||
|
numberString += "eleven"
|
||||||
|
elif(onesPlace == 0):
|
||||||
|
numberString += "ten"
|
||||||
|
#If this if was hit number was used up
|
||||||
|
number = 0
|
||||||
|
|
||||||
|
#Check for ones place
|
||||||
|
if(number >= 1):
|
||||||
|
if(number == 9):
|
||||||
|
numberString += "nine"
|
||||||
|
elif(number == 8):
|
||||||
|
numberString += "eight"
|
||||||
|
elif(number == 7):
|
||||||
|
numberString += "seven"
|
||||||
|
elif(number == 6):
|
||||||
|
numberString += "six"
|
||||||
|
elif(number == 5):
|
||||||
|
numberString += "five"
|
||||||
|
elif(number == 4):
|
||||||
|
numberString += "four"
|
||||||
|
elif(number == 3):
|
||||||
|
numberString += "three"
|
||||||
|
elif(number == 2):
|
||||||
|
numberString += "two"
|
||||||
|
elif(number == 1):
|
||||||
|
numberString += "one"
|
||||||
|
#If this if was hit number was used up
|
||||||
|
number = 0
|
||||||
|
|
||||||
|
#Return the string
|
||||||
|
return numberString
|
||||||
|
#Get the number of alphabetic characters in the string passed in
|
||||||
|
def getNumberChars(self, number: str) -> int:
|
||||||
|
sumOfLetters = 0
|
||||||
|
#Start at location 0 and count the number of letters, ignoring punctuation and whitespace
|
||||||
|
for location in range(0, len(number)):
|
||||||
|
tempString = number[location]
|
||||||
|
if(tempString.isalpha()):
|
||||||
|
sumOfLetters += 1
|
||||||
|
|
||||||
|
#Return the number
|
||||||
|
return sumOfLetters
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.letterCount = 0
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the number of letters asked for
|
||||||
|
def getLetterCount(self):
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the number of letters")
|
||||||
|
return self.letterCount
|
||||||
|
|
||||||
|
|
||||||
|
#If you are running this file, automatically start the correct function
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem17()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
"""Results:
|
||||||
|
The sum of all the letters in all the numbers 1-1000 is 21124
|
||||||
|
It took 4.107 milliseconds to run this algorithm
|
||||||
|
"""
|
||||||
194
Problems/Problem18.py
Normal file
194
Problems/Problem18.py
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
#ProjectEuler/Python/Problem18.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 03-12-19
|
||||||
|
#Modified: 07-20-20
|
||||||
|
#Find the maximum total from top to bottom
|
||||||
|
"""
|
||||||
|
75
|
||||||
|
95 64
|
||||||
|
17 47 82
|
||||||
|
18 35 87 10
|
||||||
|
20 04 82 47 65
|
||||||
|
19 01 23 75 03 34
|
||||||
|
88 02 77 73 07 63 67
|
||||||
|
99 65 04 28 06 16 70 92
|
||||||
|
41 41 26 56 83 40 80 70 33
|
||||||
|
41 48 72 33 47 32 37 16 94 29
|
||||||
|
53 71 44 65 25 43 91 52 97 51 14
|
||||||
|
70 11 33 28 77 73 17 78 39 68 17 57
|
||||||
|
91 71 52 38 17 14 91 43 58 50 27 29 48
|
||||||
|
63 66 04 68 89 53 67 30 73 16 69 87 40 31
|
||||||
|
04 62 98 27 23 09 70 98 73 93 38 53 60 04 23
|
||||||
|
"""
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
from collections import namedtuple
|
||||||
|
|
||||||
|
|
||||||
|
class Problem18(Problem):
|
||||||
|
#Structures
|
||||||
|
location = namedtuple("location", "xLocation yLocation total fromRight")
|
||||||
|
|
||||||
|
#Variables
|
||||||
|
__numRows = 15
|
||||||
|
__listNum = [[75],
|
||||||
|
[95, 64],
|
||||||
|
[17, 47, 82],
|
||||||
|
[18, 35, 87, 10],
|
||||||
|
[20, 4, 82, 47, 65],
|
||||||
|
[19, 1, 23, 75, 3, 34],
|
||||||
|
[88, 2, 77, 73, 7, 63, 67],
|
||||||
|
[99, 65, 4, 28, 6, 16, 70, 92],
|
||||||
|
[41, 41, 26, 56, 83, 40, 80, 70, 33],
|
||||||
|
[41, 48, 72, 33, 47, 32, 37, 16, 94, 29],
|
||||||
|
[53, 71, 44, 65, 25, 43, 91, 52, 97, 51, 14],
|
||||||
|
[70, 11, 33, 28, 77, 73, 17, 78, 39, 68, 17, 57],
|
||||||
|
[91, 71, 52, 38, 17, 14, 91, 43, 58, 50, 27, 29, 48],
|
||||||
|
[63, 66, 4, 68, 89, 53, 67, 30, 73, 16, 69, 87, 40, 31],
|
||||||
|
[ 4, 62, 98, 27, 23, 9, 70, 98, 73, 93, 38, 53, 60, 4, 23]]
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("Find the maximum total from top to bottom")
|
||||||
|
self.foundPoints = [] #For the points that I have already found the shortest distance to
|
||||||
|
self.possiblePoints = [] #For the locations you are checking this round
|
||||||
|
self.actualTotal = 0 #The true total of the path from the top to the bottom
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Invert the list so that each element = 100 - element
|
||||||
|
self.invert()
|
||||||
|
|
||||||
|
#Add the tip of the pyramid because everything has to go through that
|
||||||
|
self.foundPoints.append(self.location(0, 0, self.__listNum[0][0], True))
|
||||||
|
#Add the second row as possible points because everything must pass through the second row
|
||||||
|
self.possiblePoints.append(self.location(0, 1, (self.__listNum[0][0] + self.__listNum[1][0]), True))
|
||||||
|
self.possiblePoints.append(self.location(1, 1, (self.__listNum[0][0] + self.__listNum[1][1]), False))
|
||||||
|
foundBottom = False
|
||||||
|
|
||||||
|
#Loop until you find the bottom
|
||||||
|
while(not foundBottom):
|
||||||
|
#Check which possible point gives us the lowest number. If more than one has the same number simply keep the first one
|
||||||
|
minLoc = self.possiblePoints[0]
|
||||||
|
for loc in self.possiblePoints:
|
||||||
|
if(loc.total < minLoc.total):
|
||||||
|
minLoc = loc
|
||||||
|
|
||||||
|
#Remove it from the list of possible points
|
||||||
|
self.removeIf(self.possiblePoints, minLoc)
|
||||||
|
|
||||||
|
self.foundPoints.append(minLoc)
|
||||||
|
|
||||||
|
#Add to the list of possible points from the point we just found and
|
||||||
|
#If you are at the bottom raise the flag to end the program
|
||||||
|
xLoc = minLoc.xLocation
|
||||||
|
yLoc = minLoc.yLocation + 1
|
||||||
|
if(yLoc >= self.__numRows):
|
||||||
|
foundBottom = True
|
||||||
|
else:
|
||||||
|
self.possiblePoints.append(self.location(xLoc, yLoc, minLoc.total + self.__listNum[yLoc][xLoc], True))
|
||||||
|
xLoc += 1
|
||||||
|
self.possiblePoints.append(self.location(xLoc, yLoc, minLoc.total + self.__listNum[yLoc][xLoc], False))
|
||||||
|
|
||||||
|
#Get the real total of the journey
|
||||||
|
self.actualTotal = ((100 * self.__numRows) - self.foundPoints[len(self.foundPoints) - 1].total)
|
||||||
|
|
||||||
|
#Invert the list so it can be read again
|
||||||
|
self.invert()
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The value of the longest path is " + str(self.actualTotal)
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
|
||||||
|
#This function turns every number in the array into (100 - num) to allow you to find the largest numbers rather than the smallest
|
||||||
|
def invert(self):
|
||||||
|
for rowCnt in range(0, self.__numRows):
|
||||||
|
for colCnt in range(0, len(self.__listNum[rowCnt])):
|
||||||
|
self.__listNum[rowCnt][colCnt] = 100 - self.__listNum[rowCnt][colCnt]
|
||||||
|
#This function removes every element in listNum that is equal to loc
|
||||||
|
def removeIf(self, listNum: list, loc: tuple):
|
||||||
|
location = 0
|
||||||
|
while(location < len(listNum)):
|
||||||
|
if((listNum[location].xLocation == loc.xLocation) and (listNum[location].yLocation == loc.yLocation)):
|
||||||
|
del listNum[location]
|
||||||
|
else:
|
||||||
|
location += 1
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.foundPoints.clear()
|
||||||
|
self.possiblePoints.clear()
|
||||||
|
actualTotal = 0
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the pyramid that was traversed as a string
|
||||||
|
def getPyramid(self) -> str:
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the pyramid")
|
||||||
|
|
||||||
|
results = ""
|
||||||
|
#Loop through all elements of the list and print them
|
||||||
|
for row in self.__listNum:
|
||||||
|
for column in row:
|
||||||
|
results += "{:02d}".format(column)
|
||||||
|
results += '\n'
|
||||||
|
return results
|
||||||
|
#Returns the trail the algorithm took as a string
|
||||||
|
def getTrail(self) -> str:
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the trail")
|
||||||
|
#TODO: Implement this
|
||||||
|
return ""
|
||||||
|
#Returns the total that was asked for
|
||||||
|
def getTotal(self) -> int:
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the total")
|
||||||
|
return self.actualTotal
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem18()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
""" Results:
|
||||||
|
The value of the longest path is 1074
|
||||||
|
It took 654.691 microseconds to run this algorithm
|
||||||
|
"""
|
||||||
194
Problems/Problem19.py
Normal file
194
Problems/Problem19.py
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
#ProjectEuler/Python/Problem19.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 03-13-19
|
||||||
|
#Modified: 07-18-20
|
||||||
|
#How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?
|
||||||
|
"""
|
||||||
|
You are given the following information, but you may prefer to do some research for yourself.
|
||||||
|
1 Jan 1900 was a Monday.
|
||||||
|
Thirty days has September,
|
||||||
|
April, June and November.
|
||||||
|
All the rest have thirty-one,
|
||||||
|
Saving February alone,
|
||||||
|
Which has twenty-eight, rain or shine.
|
||||||
|
And on leap years, twenty-nine.
|
||||||
|
A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400.
|
||||||
|
"""
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
|
class DAYS:
|
||||||
|
SUNDAY = 0
|
||||||
|
MONDAY = 1
|
||||||
|
TUESDAY = 2
|
||||||
|
WEDNESDAY = 3
|
||||||
|
THURSDAY = 4
|
||||||
|
FRIDAY = 5
|
||||||
|
SATURDAY = 6
|
||||||
|
NUMBER_OF_DAYS = 7
|
||||||
|
ERROR = 8
|
||||||
|
|
||||||
|
class Problem19(Problem):
|
||||||
|
#Variables
|
||||||
|
__startYear = 1901 #The year we start counting sundays
|
||||||
|
__endYear = 2000 #The year we stop counting sundays
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?")
|
||||||
|
self.totalSundays = 0 #Keep track of the number of sundays
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Run for all years from start to end
|
||||||
|
for year in range(self.__startYear, self.__endYear + 1):
|
||||||
|
#Run for all months in the year
|
||||||
|
for month in range(1, 13):
|
||||||
|
day = self.getDay(month, 1, year)
|
||||||
|
if(day == DAYS.ERROR):
|
||||||
|
self.result = "There was an error with the day"
|
||||||
|
return
|
||||||
|
elif(day == DAYS.SUNDAY):
|
||||||
|
self.totalSundays += 1
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "There are " + str(self.totalSundays) + " Sundays that landed on the first of the month from " + str(self.__startYear) + " to " + str(self.__endYear)
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Return the day of the week that the date you pass into it is on
|
||||||
|
def getDay(self, month: int, day: int, year: int) -> DAYS:
|
||||||
|
#Make sure the numebrs are within propper bounds
|
||||||
|
if((month < 1) or (month > 12) or (day < 1) or (day > 31) or (year < 1)):
|
||||||
|
return DAYS.ERROR
|
||||||
|
|
||||||
|
numDays = 0 #The number of days between 01-01-0001 and the date given
|
||||||
|
currentYear = 1
|
||||||
|
currentMonth = 1
|
||||||
|
currentDay = DAYS.SATURDAY
|
||||||
|
day -= 1
|
||||||
|
|
||||||
|
#Add the correct number of days for every year
|
||||||
|
while(currentYear < year):
|
||||||
|
if(self.isLeapYear(currentYear)):
|
||||||
|
numDays += 366
|
||||||
|
else:
|
||||||
|
numDays += 365
|
||||||
|
currentYear += 1
|
||||||
|
#Add the correct number of days for eveyr month
|
||||||
|
while(currentMonth < month):
|
||||||
|
#February
|
||||||
|
if(currentMonth == 2):
|
||||||
|
if(self.isLeapYear(currentYear)):
|
||||||
|
numDays += 29
|
||||||
|
else:
|
||||||
|
numDays += 28
|
||||||
|
elif((currentMonth == 1) or (currentMonth == 3) or (currentMonth == 5) or (currentMonth == 7) or (currentMonth == 8) or (currentMonth == 10) or (currentMonth == 12)):
|
||||||
|
numDays += 31
|
||||||
|
#For 30 day months
|
||||||
|
else:
|
||||||
|
numDays += 30
|
||||||
|
currentMonth += 1
|
||||||
|
#Account for the weird year of 1752
|
||||||
|
if(year > 1752):
|
||||||
|
numDays -= 11
|
||||||
|
elif(year == 1752):
|
||||||
|
if(month > 9):
|
||||||
|
numDays -= 11
|
||||||
|
elif(month == 9):
|
||||||
|
if(day >= 14):
|
||||||
|
numDays -= 11
|
||||||
|
#Days 3-13 were skipped that year
|
||||||
|
elif((day > 2) and (day < 14)):
|
||||||
|
return DAYS.ERROR
|
||||||
|
#Add the correct number of days for every day
|
||||||
|
numDays += day
|
||||||
|
|
||||||
|
currentDay += numDays
|
||||||
|
currentDay = currentDay % DAYS.NUMBER_OF_DAYS
|
||||||
|
if(currentDay == DAYS.SUNDAY):
|
||||||
|
return DAYS.SUNDAY
|
||||||
|
elif(currentDay == DAYS.MONDAY):
|
||||||
|
return DAYS.MONDAY
|
||||||
|
elif(currentDay == DAYS.TUESDAY):
|
||||||
|
return DAYS.TUESDAY
|
||||||
|
elif(currentDay == DAYS.WEDNESDAY):
|
||||||
|
return DAYS.WEDNESDAY
|
||||||
|
elif(currentDay == DAYS.THURSDAY):
|
||||||
|
return DAYS.THURSDAY
|
||||||
|
elif(currentDay == DAYS.FRIDAY):
|
||||||
|
return DAYS.FRIDAY
|
||||||
|
elif(currentDay == DAYS.SATURDAY):
|
||||||
|
return DAYS.SATURDAY
|
||||||
|
else:
|
||||||
|
return DAYS.ERROR
|
||||||
|
#Returns true if the year passed to it is a leap year
|
||||||
|
def isLeapYear(self, year: int) -> bool:
|
||||||
|
if(year < 1):
|
||||||
|
return False
|
||||||
|
elif((year % 100) == 0):
|
||||||
|
#This rule only applies at and after 1800
|
||||||
|
if(year <= 1700):
|
||||||
|
return True
|
||||||
|
elif((year % 400) == 0):
|
||||||
|
return True
|
||||||
|
elif((year % 4) == 0):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the total sundays that were asked for
|
||||||
|
def getTotalSundays(self):
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the total sundays")
|
||||||
|
return self.totalSundays
|
||||||
|
|
||||||
|
|
||||||
|
#Run automatically if the script was called stand alone
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem19()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
|
||||||
|
""" Results:
|
||||||
|
There are 171 Sundays that landed on the first of the month from 1901 to 2000
|
||||||
|
It took 724.930 milliseconds to run this algorithm
|
||||||
|
"""
|
||||||
92
Problems/Problem2.py
Normal file
92
Problems/Problem2.py
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
#ProjectEuler/Python/Problem2.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 01-26-19
|
||||||
|
#Modified: 07-17-20
|
||||||
|
#The sum of the even Fibonacci numbers less than 4,000,000
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Algorithms import getAllFib
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
|
class Problem2(Problem):
|
||||||
|
#Variables
|
||||||
|
__topNumber = 4000000 - 1
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("What is the sum of the even Fibonacci numbers less than 4,000,000?")
|
||||||
|
self.fullSum = 0
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Get a list of all fibonacci numbers < 4,000,000
|
||||||
|
fibNums = getAllFib(self.__topNumber) #Send it - 1 because it is < __topNumber
|
||||||
|
#Step through every element in the list checking if it is even
|
||||||
|
for num in fibNums:
|
||||||
|
#If the number is even add it to the running tally
|
||||||
|
if((num % 2) == 0):
|
||||||
|
self.fullSum += num
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The sum of all even Fibonacci numbers less than " + str(self.__topNumber) + " is " + str(self.fullSum)
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
|
||||||
|
#Reset the problem
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.fullSum = 0
|
||||||
|
#Gets
|
||||||
|
#Returns the requested sum
|
||||||
|
def getSum(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the sum")
|
||||||
|
return self.fullSum
|
||||||
|
|
||||||
|
#If you are running this file, automatically start the correct function
|
||||||
|
if __name__ == '__main__':
|
||||||
|
problem = Problem2() #Call the function that answers the question
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
"""Results:
|
||||||
|
The sum of all even Fibonacci numbers less than 4000000 is 4613732
|
||||||
|
It took 27.621 microseconds to run this algorithm
|
||||||
|
"""
|
||||||
102
Problems/Problem20.py
Normal file
102
Problems/Problem20.py
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
#ProjectEuler/Python/Problem20.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 03-14-19
|
||||||
|
#Modified: 07-19-20
|
||||||
|
#What is the sum of the digits of 100!
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
|
class Problem20(Problem):
|
||||||
|
#Variables
|
||||||
|
__top_num = 100 #The number that you are trying to find the factorial of
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("What is the sum of the digits of 100!?")
|
||||||
|
self.num = 1 #Holds the number 100!
|
||||||
|
self.sum = 0 #The sum of the digts of num
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Run through every number from 1 to 100 and multiply it by the current num to get 100!
|
||||||
|
for cnt in range(1, self.__top_num + 1):
|
||||||
|
self.num *= cnt
|
||||||
|
|
||||||
|
#Get a string of the number because it is easier to pull appart the individual charaters for the sum
|
||||||
|
numString = str(self.num)
|
||||||
|
#Run through every character in the string, convert it back to an integer and add it to the running sum
|
||||||
|
for char in numString:
|
||||||
|
self.sum += int(char)
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "100! = " + numString + "\nThe sum of the digits is: " + str(self.sum)
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.num = 1
|
||||||
|
self.sum = 0
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the number 100!
|
||||||
|
def getNumber(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the number")
|
||||||
|
return self.num
|
||||||
|
#Returns the sum of the digits of 100!
|
||||||
|
def getSum(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the sum")
|
||||||
|
return self.sum
|
||||||
|
|
||||||
|
#This starts the correct function if called directly
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem20()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
""" Results:
|
||||||
|
100! = 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
|
||||||
|
The sum of the digits is: 648
|
||||||
|
It took 99.670 microseconds to run this algorithm
|
||||||
|
"""
|
||||||
125
Problems/Problem21.py
Normal file
125
Problems/Problem21.py
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
#ProjectEuler/Python/Problem21.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 03-18-19
|
||||||
|
#Modified: 07-19-20
|
||||||
|
#Evaluate the sum of all the amicable numbers under 10000
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
import Algorithms
|
||||||
|
|
||||||
|
|
||||||
|
class Problem21(Problem):
|
||||||
|
#Variables
|
||||||
|
__limit = 10000 #The top number that will be evaluated
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("Evaluate the sum of all the amicable numbers under 10000")
|
||||||
|
self.divisorSum = [] #Holds the sum of the divisors of the subscript number
|
||||||
|
self.amicable = [] #Holds all amicable numbers
|
||||||
|
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Generate the divisors of all the numbers < 10000, get their sum, and add it to the list
|
||||||
|
self.divisorSum.append(0) #Start with a 0 in the [0] location
|
||||||
|
for cnt in range(1, self.__limit):
|
||||||
|
divisors = Algorithms.getDivisors(cnt) #Get all the divisors of a number
|
||||||
|
if(len(divisors) > 1):
|
||||||
|
divisors.pop() #Remove the last entry because it will be the number itself
|
||||||
|
self.divisorSum.append(int(sum(divisors)))
|
||||||
|
#Check every sum of divisors in the list for a matching sum
|
||||||
|
for cnt in range(1, len(self.divisorSum)):
|
||||||
|
currentSum = self.divisorSum[cnt]
|
||||||
|
#If the sum is greater than the number of divisors then it is impossible to be amicable. Skip the number and continue
|
||||||
|
if(currentSum >= len(self.divisorSum)):
|
||||||
|
continue
|
||||||
|
#We know that divisorSum[cnt] == currentSum, so if divisorSum[currentSum] == cnt we found an amicable number
|
||||||
|
if(self.divisorSum[currentSum] == cnt):
|
||||||
|
#A number can't be amicable with itself
|
||||||
|
if(currentSum == cnt):
|
||||||
|
continue
|
||||||
|
#Add the number to the amicable vector
|
||||||
|
self.amicable.append(cnt)
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result += "All amicable numbers less than 10000 are"
|
||||||
|
for num in self.amicable:
|
||||||
|
self.result += str(num) + '\n'
|
||||||
|
self.result += "The sum of all of these amicable numbers is " + str(sum(self.amicable))
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.divisorSum.clear()
|
||||||
|
self.amicable.clear()
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns a vector with all of the amicable number calculated
|
||||||
|
def getAmicable(self) -> list:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the amicable numbers")
|
||||||
|
return self.amicable
|
||||||
|
#Returns the sum of all of the amicable numbers
|
||||||
|
def getSum(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the sum of the amicable numbers")
|
||||||
|
return sum(self.amicable)
|
||||||
|
|
||||||
|
#Run the correct function if this script is called stand along
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem21()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
""" Results:
|
||||||
|
All amicable numbers less than 10000 are
|
||||||
|
220
|
||||||
|
284
|
||||||
|
1184
|
||||||
|
1210
|
||||||
|
2620
|
||||||
|
2924
|
||||||
|
5020
|
||||||
|
5564
|
||||||
|
6232
|
||||||
|
6368
|
||||||
|
The sum of all of these amicable numbers is 31626
|
||||||
|
It took 59.496 milliseconds to run this algorithm
|
||||||
|
"""
|
||||||
472
Problems/Problem22.py
Normal file
472
Problems/Problem22.py
Normal file
@@ -0,0 +1,472 @@
|
|||||||
|
#ProjectEuler/Python/Problem22.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 03-20-19
|
||||||
|
#Modified: 07-19-20
|
||||||
|
#What is the total of all the name scores in the file?
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
import Algorithms
|
||||||
|
|
||||||
|
|
||||||
|
class Problem22(Problem):
|
||||||
|
#Variables
|
||||||
|
__names = ["MARY","PATRICIA","LINDA","BARBARA","ELIZABETH","JENNIFER","MARIA","SUSAN","MARGARET","DOROTHY","LISA","NANCY","KAREN",
|
||||||
|
"BETTY","HELEN","SANDRA","DONNA","CAROL","RUTH","SHARON","MICHELLE","LAURA","SARAH","KIMBERLY","DEBORAH","JESSICA","SHIRLEY",
|
||||||
|
"CYNTHIA","ANGELA","MELISSA","BRENDA","AMY","ANNA","REBECCA","VIRGINIA","KATHLEEN","PAMELA","MARTHA","DEBRA","AMANDA","STEPHANIE",
|
||||||
|
"CAROLYN","CHRISTINE","MARIE","JANET","CATHERINE","FRANCES","ANN","JOYCE","DIANE","ALICE","JULIE","HEATHER","TERESA","DORIS",
|
||||||
|
"GLORIA","EVELYN","JEAN","CHERYL","MILDRED","KATHERINE","JOAN","ASHLEY","JUDITH","ROSE","JANICE","KELLY","NICOLE","JUDY",
|
||||||
|
"CHRISTINA","KATHY","THERESA","BEVERLY","DENISE","TAMMY","IRENE","JANE","LORI","RACHEL","MARILYN","ANDREA","KATHRYN","LOUISE",
|
||||||
|
"SARA","ANNE","JACQUELINE","WANDA","BONNIE","JULIA","RUBY","LOIS","TINA","PHYLLIS","NORMA","PAULA","DIANA","ANNIE","LILLIAN",
|
||||||
|
"EMILY","ROBIN","PEGGY","CRYSTAL","GLADYS","RITA","DAWN","CONNIE","FLORENCE","TRACY","EDNA","TIFFANY","CARMEN","ROSA","CINDY",
|
||||||
|
"GRACE","WENDY","VICTORIA","EDITH","KIM","SHERRY","SYLVIA","JOSEPHINE","THELMA","SHANNON","SHEILA","ETHEL","ELLEN","ELAINE",
|
||||||
|
"MARJORIE","CARRIE","CHARLOTTE","MONICA","ESTHER","PAULINE","EMMA","JUANITA","ANITA","RHONDA","HAZEL","AMBER","EVA","DEBBIE",
|
||||||
|
"APRIL","LESLIE","CLARA","LUCILLE","JAMIE","JOANNE","ELEANOR","VALERIE","DANIELLE","MEGAN","ALICIA","SUZANNE","MICHELE","GAIL",
|
||||||
|
"BERTHA","DARLENE","VERONICA","JILL","ERIN","GERALDINE","LAUREN","CATHY","JOANN","LORRAINE","LYNN","SALLY","REGINA","ERICA",
|
||||||
|
"BEATRICE","DOLORES","BERNICE","AUDREY","YVONNE","ANNETTE","JUNE","SAMANTHA","MARION","DANA","STACY","ANA","RENEE","IDA","VIVIAN",
|
||||||
|
"ROBERTA","HOLLY","BRITTANY","MELANIE","LORETTA","YOLANDA","JEANETTE","LAURIE","KATIE","KRISTEN","VANESSA","ALMA","SUE","ELSIE",
|
||||||
|
"BETH","JEANNE","VICKI","CARLA","TARA","ROSEMARY","EILEEN","TERRI","GERTRUDE","LUCY","TONYA","ELLA","STACEY","WILMA","GINA",
|
||||||
|
"KRISTIN","JESSIE","NATALIE","AGNES","VERA","WILLIE","CHARLENE","BESSIE","DELORES","MELINDA","PEARL","ARLENE","MAUREEN","COLLEEN",
|
||||||
|
"ALLISON","TAMARA","JOY","GEORGIA","CONSTANCE","LILLIE","CLAUDIA","JACKIE","MARCIA","TANYA","NELLIE","MINNIE","MARLENE","HEIDI",
|
||||||
|
"GLENDA","LYDIA","VIOLA","COURTNEY","MARIAN","STELLA","CAROLINE","DORA","JO","VICKIE","MATTIE","TERRY","MAXINE","IRMA","MABEL",
|
||||||
|
"MARSHA","MYRTLE","LENA","CHRISTY","DEANNA","PATSY","HILDA","GWENDOLYN","JENNIE","NORA","MARGIE","NINA","CASSANDRA","LEAH","PENNY",
|
||||||
|
"KAY","PRISCILLA","NAOMI","CAROLE","BRANDY","OLGA","BILLIE","DIANNE","TRACEY","LEONA","JENNY","FELICIA","SONIA","MIRIAM","VELMA",
|
||||||
|
"BECKY","BOBBIE","VIOLET","KRISTINA","TONI","MISTY","MAE","SHELLY","DAISY","RAMONA","SHERRI","ERIKA","KATRINA","CLAIRE","LINDSEY",
|
||||||
|
"LINDSAY","GENEVA","GUADALUPE","BELINDA","MARGARITA","SHERYL","CORA","FAYE","ADA","NATASHA","SABRINA","ISABEL","MARGUERITE",
|
||||||
|
"HATTIE","HARRIET","MOLLY","CECILIA","KRISTI","BRANDI","BLANCHE","SANDY","ROSIE","JOANNA","IRIS","EUNICE","ANGIE","INEZ","LYNDA",
|
||||||
|
"MADELINE","AMELIA","ALBERTA","GENEVIEVE","MONIQUE","JODI","JANIE","MAGGIE","KAYLA","SONYA","JAN","LEE","KRISTINE","CANDACE",
|
||||||
|
"FANNIE","MARYANN","OPAL","ALISON","YVETTE","MELODY","LUZ","SUSIE","OLIVIA","FLORA","SHELLEY","KRISTY","MAMIE","LULA","LOLA",
|
||||||
|
"VERNA","BEULAH","ANTOINETTE","CANDICE","JUANA","JEANNETTE","PAM","KELLI","HANNAH","WHITNEY","BRIDGET","KARLA","CELIA","LATOYA",
|
||||||
|
"PATTY","SHELIA","GAYLE","DELLA","VICKY","LYNNE","SHERI","MARIANNE","KARA","JACQUELYN","ERMA","BLANCA","MYRA","LETICIA","PAT",
|
||||||
|
"KRISTA","ROXANNE","ANGELICA","JOHNNIE","ROBYN","FRANCIS","ADRIENNE","ROSALIE","ALEXANDRA","BROOKE","BETHANY","SADIE","BERNADETTE",
|
||||||
|
"TRACI","JODY","KENDRA","JASMINE","NICHOLE","RACHAEL","CHELSEA","MABLE","ERNESTINE","MURIEL","MARCELLA","ELENA","KRYSTAL",
|
||||||
|
"ANGELINA","NADINE","KARI","ESTELLE","DIANNA","PAULETTE","LORA","MONA","DOREEN","ROSEMARIE","ANGEL","DESIREE","ANTONIA","HOPE",
|
||||||
|
"GINGER","JANIS","BETSY","CHRISTIE","FREDA","MERCEDES","MEREDITH","LYNETTE","TERI","CRISTINA","EULA","LEIGH","MEGHAN","SOPHIA",
|
||||||
|
"ELOISE","ROCHELLE","GRETCHEN","CECELIA","RAQUEL","HENRIETTA","ALYSSA","JANA","KELLEY","GWEN","KERRY","JENNA","TRICIA","LAVERNE",
|
||||||
|
"OLIVE","ALEXIS","TASHA","SILVIA","ELVIRA","CASEY","DELIA","SOPHIE","KATE","PATTI","LORENA","KELLIE","SONJA","LILA","LANA","DARLA",
|
||||||
|
"MAY","MINDY","ESSIE","MANDY","LORENE","ELSA","JOSEFINA","JEANNIE","MIRANDA","DIXIE","LUCIA","MARTA","FAITH","LELA","JOHANNA",
|
||||||
|
"SHARI","CAMILLE","TAMI","SHAWNA","ELISA","EBONY","MELBA","ORA","NETTIE","TABITHA","OLLIE","JAIME","WINIFRED","KRISTIE","MARINA",
|
||||||
|
"ALISHA","AIMEE","RENA","MYRNA","MARLA","TAMMIE","LATASHA","BONITA","PATRICE","RONDA","SHERRIE","ADDIE","FRANCINE","DELORIS",
|
||||||
|
"STACIE","ADRIANA","CHERI","SHELBY","ABIGAIL","CELESTE","JEWEL","CARA","ADELE","REBEKAH","LUCINDA","DORTHY","CHRIS","EFFIE",
|
||||||
|
"TRINA","REBA","SHAWN","SALLIE","AURORA","LENORA","ETTA","LOTTIE","KERRI","TRISHA","NIKKI","ESTELLA","FRANCISCA","JOSIE","TRACIE",
|
||||||
|
"MARISSA","KARIN","BRITTNEY","JANELLE","LOURDES","LAUREL","HELENE","FERN","ELVA","CORINNE","KELSEY","INA","BETTIE","ELISABETH",
|
||||||
|
"AIDA","CAITLIN","INGRID","IVA","EUGENIA","CHRISTA","GOLDIE","CASSIE","MAUDE","JENIFER","THERESE","FRANKIE","DENA","LORNA",
|
||||||
|
"JANETTE","LATONYA","CANDY","MORGAN","CONSUELO","TAMIKA","ROSETTA","DEBORA","CHERIE","POLLY","DINA","JEWELL","FAY","JILLIAN",
|
||||||
|
"DOROTHEA","NELL","TRUDY","ESPERANZA","PATRICA","KIMBERLEY","SHANNA","HELENA","CAROLINA","CLEO","STEFANIE","ROSARIO","OLA",
|
||||||
|
"JANINE","MOLLIE","LUPE","ALISA","LOU","MARIBEL","SUSANNE","BETTE","SUSANA","ELISE","CECILE","ISABELLE","LESLEY","JOCELYN",
|
||||||
|
"PAIGE","JONI","RACHELLE","LEOLA","DAPHNE","ALTA","ESTER","PETRA","GRACIELA","IMOGENE","JOLENE","KEISHA","LACEY","GLENNA",
|
||||||
|
"GABRIELA","KERI","URSULA","LIZZIE","KIRSTEN","SHANA","ADELINE","MAYRA","JAYNE","JACLYN","GRACIE","SONDRA","CARMELA","MARISA",
|
||||||
|
"ROSALIND","CHARITY","TONIA","BEATRIZ","MARISOL","CLARICE","JEANINE","SHEENA","ANGELINE","FRIEDA","LILY","ROBBIE","SHAUNA",
|
||||||
|
"MILLIE","CLAUDETTE","CATHLEEN","ANGELIA","GABRIELLE","AUTUMN","KATHARINE","SUMMER","JODIE","STACI","LEA","CHRISTI","JIMMIE",
|
||||||
|
"JUSTINE","ELMA","LUELLA","MARGRET","DOMINIQUE","SOCORRO","RENE","MARTINA","MARGO","MAVIS","CALLIE","BOBBI","MARITZA","LUCILE",
|
||||||
|
"LEANNE","JEANNINE","DEANA","AILEEN","LORIE","LADONNA","WILLA","MANUELA","GALE","SELMA","DOLLY","SYBIL","ABBY","LARA","DALE",
|
||||||
|
"IVY","DEE","WINNIE","MARCY","LUISA","JERI","MAGDALENA","OFELIA","MEAGAN","AUDRA","MATILDA","LEILA","CORNELIA","BIANCA","SIMONE",
|
||||||
|
"BETTYE","RANDI","VIRGIE","LATISHA","BARBRA","GEORGINA","ELIZA","LEANN","BRIDGETTE","RHODA","HALEY","ADELA","NOLA","BERNADINE",
|
||||||
|
"FLOSSIE","ILA","GRETA","RUTHIE","NELDA","MINERVA","LILLY","TERRIE","LETHA","HILARY","ESTELA","VALARIE","BRIANNA","ROSALYN",
|
||||||
|
"EARLINE","CATALINA","AVA","MIA","CLARISSA","LIDIA","CORRINE","ALEXANDRIA","CONCEPCION","TIA","SHARRON","RAE","DONA","ERICKA",
|
||||||
|
"JAMI","ELNORA","CHANDRA","LENORE","NEVA","MARYLOU","MELISA","TABATHA","SERENA","AVIS","ALLIE","SOFIA","JEANIE","ODESSA","NANNIE",
|
||||||
|
"HARRIETT","LORAINE","PENELOPE","MILAGROS","EMILIA","BENITA","ALLYSON","ASHLEE","TANIA","TOMMIE","ESMERALDA","KARINA","EVE",
|
||||||
|
"PEARLIE","ZELMA","MALINDA","NOREEN","TAMEKA","SAUNDRA","HILLARY","AMIE","ALTHEA","ROSALINDA","JORDAN","LILIA","ALANA","GAY",
|
||||||
|
"CLARE","ALEJANDRA","ELINOR","MICHAEL","LORRIE","JERRI","DARCY","EARNESTINE","CARMELLA","TAYLOR","NOEMI","MARCIE","LIZA",
|
||||||
|
"ANNABELLE","LOUISA","EARLENE","MALLORY","CARLENE","NITA","SELENA","TANISHA","KATY","JULIANNE","JOHN","LAKISHA","EDWINA",
|
||||||
|
"MARICELA","MARGERY","KENYA","DOLLIE","ROXIE","ROSLYN","KATHRINE","NANETTE","CHARMAINE","LAVONNE","ILENE","KRIS","TAMMI",
|
||||||
|
"SUZETTE","CORINE","KAYE","JERRY","MERLE","CHRYSTAL","LINA","DEANNE","LILIAN","JULIANA","ALINE","LUANN","KASEY","MARYANNE",
|
||||||
|
"EVANGELINE","COLETTE","MELVA","LAWANDA","YESENIA","NADIA","MADGE","KATHIE","EDDIE","OPHELIA","VALERIA","NONA","MITZI","MARI",
|
||||||
|
"GEORGETTE","CLAUDINE","FRAN","ALISSA","ROSEANN","LAKEISHA","SUSANNA","REVA","DEIDRE","CHASITY","SHEREE","CARLY","JAMES","ELVIA",
|
||||||
|
"ALYCE","DEIRDRE","GENA","BRIANA","ARACELI","KATELYN","ROSANNE","WENDI","TESSA","BERTA","MARVA","IMELDA","MARIETTA","MARCI",
|
||||||
|
"LEONOR","ARLINE","SASHA","MADELYN","JANNA","JULIETTE","DEENA","AURELIA","JOSEFA","AUGUSTA","LILIANA","YOUNG","CHRISTIAN",
|
||||||
|
"LESSIE","AMALIA","SAVANNAH","ANASTASIA","VILMA","NATALIA","ROSELLA","LYNNETTE","CORINA","ALFREDA","LEANNA","CAREY","AMPARO",
|
||||||
|
"COLEEN","TAMRA","AISHA","WILDA","KARYN","CHERRY","QUEEN","MAURA","MAI","EVANGELINA","ROSANNA","HALLIE","ERNA","ENID","MARIANA",
|
||||||
|
"LACY","JULIET","JACKLYN","FREIDA","MADELEINE","MARA","HESTER","CATHRYN","LELIA","CASANDRA","BRIDGETT","ANGELITA","JANNIE",
|
||||||
|
"DIONNE","ANNMARIE","KATINA","BERYL","PHOEBE","MILLICENT","KATHERYN","DIANN","CARISSA","MARYELLEN","LIZ","LAURI","HELGA","GILDA",
|
||||||
|
"ADRIAN","RHEA","MARQUITA","HOLLIE","TISHA","TAMERA","ANGELIQUE","FRANCESCA","BRITNEY","KAITLIN","LOLITA","FLORINE","ROWENA",
|
||||||
|
"REYNA","TWILA","FANNY","JANELL","INES","CONCETTA","BERTIE","ALBA","BRIGITTE","ALYSON","VONDA","PANSY","ELBA","NOELLE","LETITIA",
|
||||||
|
"KITTY","DEANN","BRANDIE","LOUELLA","LETA","FELECIA","SHARLENE","LESA","BEVERLEY","ROBERT","ISABELLA","HERMINIA","TERRA","CELINA",
|
||||||
|
"TORI","OCTAVIA","JADE","DENICE","GERMAINE","SIERRA","MICHELL","CORTNEY","NELLY","DORETHA","SYDNEY","DEIDRA","MONIKA","LASHONDA",
|
||||||
|
"JUDI","CHELSEY","ANTIONETTE","MARGOT","BOBBY","ADELAIDE","NAN","LEEANN","ELISHA","DESSIE","LIBBY","KATHI","GAYLA","LATANYA",
|
||||||
|
"MINA","MELLISA","KIMBERLEE","JASMIN","RENAE","ZELDA","ELDA","MA","JUSTINA","GUSSIE","EMILIE","CAMILLA","ABBIE","ROCIO","KAITLYN",
|
||||||
|
"JESSE","EDYTHE","ASHLEIGH","SELINA","LAKESHA","GERI","ALLENE","PAMALA","MICHAELA","DAYNA","CARYN","ROSALIA","SUN","JACQULINE",
|
||||||
|
"REBECA","MARYBETH","KRYSTLE","IOLA","DOTTIE","BENNIE","BELLE","AUBREY","GRISELDA","ERNESTINA","ELIDA","ADRIANNE","DEMETRIA",
|
||||||
|
"DELMA","CHONG","JAQUELINE","DESTINY","ARLEEN","VIRGINA","RETHA","FATIMA","TILLIE","ELEANORE","CARI","TREVA","BIRDIE","WILHELMINA",
|
||||||
|
"ROSALEE","MAURINE","LATRICE","YONG","JENA","TARYN","ELIA","DEBBY","MAUDIE","JEANNA","DELILAH","CATRINA","SHONDA","HORTENCIA",
|
||||||
|
"THEODORA","TERESITA","ROBBIN","DANETTE","MARYJANE","FREDDIE","DELPHINE","BRIANNE","NILDA","DANNA","CINDI","BESS","IONA","HANNA",
|
||||||
|
"ARIEL","WINONA","VIDA","ROSITA","MARIANNA","WILLIAM","RACHEAL","GUILLERMINA","ELOISA","CELESTINE","CAREN","MALISSA","LONA",
|
||||||
|
"CHANTEL","SHELLIE","MARISELA","LEORA","AGATHA","SOLEDAD","MIGDALIA","IVETTE","CHRISTEN","ATHENA","JANEL","CHLOE","VEDA","PATTIE",
|
||||||
|
"TESSIE","TERA","MARILYNN","LUCRETIA","KARRIE","DINAH","DANIELA","ALECIA","ADELINA","VERNICE","SHIELA","PORTIA","MERRY","LASHAWN",
|
||||||
|
"DEVON","DARA","TAWANA","OMA","VERDA","CHRISTIN","ALENE","ZELLA","SANDI","RAFAELA","MAYA","KIRA","CANDIDA","ALVINA","SUZAN",
|
||||||
|
"SHAYLA","LYN","LETTIE","ALVA","SAMATHA","ORALIA","MATILDE","MADONNA","LARISSA","VESTA","RENITA","INDIA","DELOIS","SHANDA",
|
||||||
|
"PHILLIS","LORRI","ERLINDA","CRUZ","CATHRINE","BARB","ZOE","ISABELL","IONE","GISELA","CHARLIE","VALENCIA","ROXANNA","MAYME",
|
||||||
|
"KISHA","ELLIE","MELLISSA","DORRIS","DALIA","BELLA","ANNETTA","ZOILA","RETA","REINA","LAURETTA","KYLIE","CHRISTAL","PILAR",
|
||||||
|
"CHARLA","ELISSA","TIFFANI","TANA","PAULINA","LEOTA","BREANNA","JAYME","CARMEL","VERNELL","TOMASA","MANDI","DOMINGA","SANTA",
|
||||||
|
"MELODIE","LURA","ALEXA","TAMELA","RYAN","MIRNA","KERRIE","VENUS","NOEL","FELICITA","CRISTY","CARMELITA","BERNIECE","ANNEMARIE",
|
||||||
|
"TIARA","ROSEANNE","MISSY","CORI","ROXANA","PRICILLA","KRISTAL","JUNG","ELYSE","HAYDEE","ALETHA","BETTINA","MARGE","GILLIAN",
|
||||||
|
"FILOMENA","CHARLES","ZENAIDA","HARRIETTE","CARIDAD","VADA","UNA","ARETHA","PEARLINE","MARJORY","MARCELA","FLOR","EVETTE",
|
||||||
|
"ELOUISE","ALINA","TRINIDAD","DAVID","DAMARIS","CATHARINE","CARROLL","BELVA","NAKIA","MARLENA","LUANNE","LORINE","KARON","DORENE",
|
||||||
|
"DANITA","BRENNA","TATIANA","SAMMIE","LOUANN","LOREN","JULIANNA","ANDRIA","PHILOMENA","LUCILA","LEONORA","DOVIE","ROMONA","MIMI",
|
||||||
|
"JACQUELIN","GAYE","TONJA","MISTI","JOE","GENE","CHASTITY","STACIA","ROXANN","MICAELA","NIKITA","MEI","VELDA","MARLYS","JOHNNA",
|
||||||
|
"AURA","LAVERN","IVONNE","HAYLEY","NICKI","MAJORIE","HERLINDA","GEORGE","ALPHA","YADIRA","PERLA","GREGORIA","DANIEL","ANTONETTE",
|
||||||
|
"SHELLI","MOZELLE","MARIAH","JOELLE","CORDELIA","JOSETTE","CHIQUITA","TRISTA","LOUIS","LAQUITA","GEORGIANA","CANDI","SHANON",
|
||||||
|
"LONNIE","HILDEGARD","CECIL","VALENTINA","STEPHANY","MAGDA","KAROL","GERRY","GABRIELLA","TIANA","ROMA","RICHELLE","RAY",
|
||||||
|
"PRINCESS","OLETA","JACQUE","IDELLA","ALAINA","SUZANNA","JOVITA","BLAIR","TOSHA","RAVEN","NEREIDA","MARLYN","KYLA","JOSEPH",
|
||||||
|
"DELFINA","TENA","STEPHENIE","SABINA","NATHALIE","MARCELLE","GERTIE","DARLEEN","THEA","SHARONDA","SHANTEL","BELEN","VENESSA",
|
||||||
|
"ROSALINA","ONA","GENOVEVA","COREY","CLEMENTINE","ROSALBA","RENATE","RENATA","MI","IVORY","GEORGIANNA","FLOY","DORCAS","ARIANA",
|
||||||
|
"TYRA","THEDA","MARIAM","JULI","JESICA","DONNIE","VIKKI","VERLA","ROSELYN","MELVINA","JANNETTE","GINNY","DEBRAH","CORRIE","ASIA",
|
||||||
|
"VIOLETA","MYRTIS","LATRICIA","COLLETTE","CHARLEEN","ANISSA","VIVIANA","TWYLA","PRECIOUS","NEDRA","LATONIA","LAN","HELLEN",
|
||||||
|
"FABIOLA","ANNAMARIE","ADELL","SHARYN","CHANTAL","NIKI","MAUD","LIZETTE","LINDY","KIA","KESHA","JEANA","DANELLE","CHARLINE",
|
||||||
|
"CHANEL","CARROL","VALORIE","LIA","DORTHA","CRISTAL","SUNNY","LEONE","LEILANI","GERRI","DEBI","ANDRA","KESHIA","IMA","EULALIA",
|
||||||
|
"EASTER","DULCE","NATIVIDAD","LINNIE","KAMI","GEORGIE","CATINA","BROOK","ALDA","WINNIFRED","SHARLA","RUTHANN","MEAGHAN",
|
||||||
|
"MAGDALENE","LISSETTE","ADELAIDA","VENITA","TRENA","SHIRLENE","SHAMEKA","ELIZEBETH","DIAN","SHANTA","MICKEY","LATOSHA","CARLOTTA",
|
||||||
|
"WINDY","SOON","ROSINA","MARIANN","LEISA","JONNIE","DAWNA","CATHIE","BILLY","ASTRID","SIDNEY","LAUREEN","JANEEN","HOLLI","FAWN",
|
||||||
|
"VICKEY","TERESSA","SHANTE","RUBYE","MARCELINA","CHANDA","CARY","TERESE","SCARLETT","MARTY","MARNIE","LULU","LISETTE","JENIFFER",
|
||||||
|
"ELENOR","DORINDA","DONITA","CARMAN","BERNITA","ALTAGRACIA","ALETA","ADRIANNA","ZORAIDA","RONNIE","NICOLA","LYNDSEY","KENDALL",
|
||||||
|
"JANINA","CHRISSY","AMI","STARLA","PHYLIS","PHUONG","KYRA","CHARISSE","BLANCH","SANJUANITA","RONA","NANCI","MARILEE","MARANDA",
|
||||||
|
"CORY","BRIGETTE","SANJUANA","MARITA","KASSANDRA","JOYCELYN","IRA","FELIPA","CHELSIE","BONNY","MIREYA","LORENZA","KYONG","ILEANA",
|
||||||
|
"CANDELARIA","TONY","TOBY","SHERIE","OK","MARK","LUCIE","LEATRICE","LAKESHIA","GERDA","EDIE","BAMBI","MARYLIN","LAVON","HORTENSE",
|
||||||
|
"GARNET","EVIE","TRESSA","SHAYNA","LAVINA","KYUNG","JEANETTA","SHERRILL","SHARA","PHYLISS","MITTIE","ANABEL","ALESIA","THUY",
|
||||||
|
"TAWANDA","RICHARD","JOANIE","TIFFANIE","LASHANDA","KARISSA","ENRIQUETA","DARIA","DANIELLA","CORINNA","ALANNA","ABBEY","ROXANE",
|
||||||
|
"ROSEANNA","MAGNOLIA","LIDA","KYLE","JOELLEN","ERA","CORAL","CARLEEN","TRESA","PEGGIE","NOVELLA","NILA","MAYBELLE","JENELLE",
|
||||||
|
"CARINA","NOVA","MELINA","MARQUERITE","MARGARETTE","JOSEPHINA","EVONNE","DEVIN","CINTHIA","ALBINA","TOYA","TAWNYA","SHERITA",
|
||||||
|
"SANTOS","MYRIAM","LIZABETH","LISE","KEELY","JENNI","GISELLE","CHERYLE","ARDITH","ARDIS","ALESHA","ADRIANE","SHAINA","LINNEA",
|
||||||
|
"KAROLYN","HONG","FLORIDA","FELISHA","DORI","DARCI","ARTIE","ARMIDA","ZOLA","XIOMARA","VERGIE","SHAMIKA","NENA","NANNETTE","MAXIE",
|
||||||
|
"LOVIE","JEANE","JAIMIE","INGE","FARRAH","ELAINA","CAITLYN","STARR","FELICITAS","CHERLY","CARYL","YOLONDA","YASMIN","TEENA",
|
||||||
|
"PRUDENCE","PENNIE","NYDIA","MACKENZIE","ORPHA","MARVEL","LIZBETH","LAURETTE","JERRIE","HERMELINDA","CAROLEE","TIERRA","MIRIAN",
|
||||||
|
"META","MELONY","KORI","JENNETTE","JAMILA","ENA","ANH","YOSHIKO","SUSANNAH","SALINA","RHIANNON","JOLEEN","CRISTINE","ASHTON",
|
||||||
|
"ARACELY","TOMEKA","SHALONDA","MARTI","LACIE","KALA","JADA","ILSE","HAILEY","BRITTANI","ZONA","SYBLE","SHERRYL","RANDY","NIDIA",
|
||||||
|
"MARLO","KANDICE","KANDI","DEB","DEAN","AMERICA","ALYCIA","TOMMY","RONNA","NORENE","MERCY","JOSE","INGEBORG","GIOVANNA","GEMMA",
|
||||||
|
"CHRISTEL","AUDRY","ZORA","VITA","VAN","TRISH","STEPHAINE","SHIRLEE","SHANIKA","MELONIE","MAZIE","JAZMIN","INGA","HOA","HETTIE",
|
||||||
|
"GERALYN","FONDA","ESTRELLA","ADELLA","SU","SARITA","RINA","MILISSA","MARIBETH","GOLDA","EVON","ETHELYN","ENEDINA","CHERISE",
|
||||||
|
"CHANA","VELVA","TAWANNA","SADE","MIRTA","LI","KARIE","JACINTA","ELNA","DAVINA","CIERRA","ASHLIE","ALBERTHA","TANESHA","STEPHANI",
|
||||||
|
"NELLE","MINDI","LU","LORINDA","LARUE","FLORENE","DEMETRA","DEDRA","CIARA","CHANTELLE","ASHLY","SUZY","ROSALVA","NOELIA","LYDA",
|
||||||
|
"LEATHA","KRYSTYNA","KRISTAN","KARRI","DARLINE","DARCIE","CINDA","CHEYENNE","CHERRIE","AWILDA","ALMEDA","ROLANDA","LANETTE",
|
||||||
|
"JERILYN","GISELE","EVALYN","CYNDI","CLETA","CARIN","ZINA","ZENA","VELIA","TANIKA","PAUL","CHARISSA","THOMAS","TALIA","MARGARETE",
|
||||||
|
"LAVONDA","KAYLEE","KATHLENE","JONNA","IRENA","ILONA","IDALIA","CANDIS","CANDANCE","BRANDEE","ANITRA","ALIDA","SIGRID","NICOLETTE",
|
||||||
|
"MARYJO","LINETTE","HEDWIG","CHRISTIANA","CASSIDY","ALEXIA","TRESSIE","MODESTA","LUPITA","LITA","GLADIS","EVELIA","DAVIDA",
|
||||||
|
"CHERRI","CECILY","ASHELY","ANNABEL","AGUSTINA","WANITA","SHIRLY","ROSAURA","HULDA","EUN","BAILEY","YETTA","VERONA","THOMASINA",
|
||||||
|
"SIBYL","SHANNAN","MECHELLE","LUE","LEANDRA","LANI","KYLEE","KANDY","JOLYNN","FERNE","EBONI","CORENE","ALYSIA","ZULA","NADA",
|
||||||
|
"MOIRA","LYNDSAY","LORRETTA","JUAN","JAMMIE","HORTENSIA","GAYNELL","CAMERON","ADRIA","VINA","VICENTA","TANGELA","STEPHINE",
|
||||||
|
"NORINE","NELLA","LIANA","LESLEE","KIMBERELY","ILIANA","GLORY","FELICA","EMOGENE","ELFRIEDE","EDEN","EARTHA","CARMA","BEA","OCIE",
|
||||||
|
"MARRY","LENNIE","KIARA","JACALYN","CARLOTA","ARIELLE","YU","STAR","OTILIA","KIRSTIN","KACEY","JOHNETTA","JOEY","JOETTA",
|
||||||
|
"JERALDINE","JAUNITA","ELANA","DORTHEA","CAMI","AMADA","ADELIA","VERNITA","TAMAR","SIOBHAN","RENEA","RASHIDA","OUIDA","ODELL",
|
||||||
|
"NILSA","MERYL","KRISTYN","JULIETA","DANICA","BREANNE","AUREA","ANGLEA","SHERRON","ODETTE","MALIA","LORELEI","LIN","LEESA",
|
||||||
|
"KENNA","KATHLYN","FIONA","CHARLETTE","SUZIE","SHANTELL","SABRA","RACQUEL","MYONG","MIRA","MARTINE","LUCIENNE","LAVADA","JULIANN",
|
||||||
|
"JOHNIE","ELVERA","DELPHIA","CLAIR","CHRISTIANE","CHAROLETTE","CARRI","AUGUSTINE","ASHA","ANGELLA","PAOLA","NINFA","LEDA","LAI",
|
||||||
|
"EDA","SUNSHINE","STEFANI","SHANELL","PALMA","MACHELLE","LISSA","KECIA","KATHRYNE","KARLENE","JULISSA","JETTIE","JENNIFFER","HUI",
|
||||||
|
"CORRINA","CHRISTOPHER","CAROLANN","ALENA","TESS","ROSARIA","MYRTICE","MARYLEE","LIANE","KENYATTA","JUDIE","JANEY","IN","ELMIRA",
|
||||||
|
"ELDORA","DENNA","CRISTI","CATHI","ZAIDA","VONNIE","VIVA","VERNIE","ROSALINE","MARIELA","LUCIANA","LESLI","KARAN","FELICE",
|
||||||
|
"DENEEN","ADINA","WYNONA","TARSHA","SHERON","SHASTA","SHANITA","SHANI","SHANDRA","RANDA","PINKIE","PARIS","NELIDA","MARILOU",
|
||||||
|
"LYLA","LAURENE","LACI","JOI","JANENE","DOROTHA","DANIELE","DANI","CAROLYNN","CARLYN","BERENICE","AYESHA","ANNELIESE","ALETHEA",
|
||||||
|
"THERSA","TAMIKO","RUFINA","OLIVA","MOZELL","MARYLYN","MADISON","KRISTIAN","KATHYRN","KASANDRA","KANDACE","JANAE","GABRIEL",
|
||||||
|
"DOMENICA","DEBBRA","DANNIELLE","CHUN","BUFFY","BARBIE","ARCELIA","AJA","ZENOBIA","SHAREN","SHAREE","PATRICK","PAGE","MY",
|
||||||
|
"LAVINIA","KUM","KACIE","JACKELINE","HUONG","FELISA","EMELIA","ELEANORA","CYTHIA","CRISTIN","CLYDE","CLARIBEL","CARON",
|
||||||
|
"ANASTACIA","ZULMA","ZANDRA","YOKO","TENISHA","SUSANN","SHERILYN","SHAY","SHAWANDA","SABINE","ROMANA","MATHILDA","LINSEY",
|
||||||
|
"KEIKO","JOANA","ISELA","GRETTA","GEORGETTA","EUGENIE","DUSTY","DESIRAE","DELORA","CORAZON","ANTONINA","ANIKA","WILLENE","TRACEE",
|
||||||
|
"TAMATHA","REGAN","NICHELLE","MICKIE","MAEGAN","LUANA","LANITA","KELSIE","EDELMIRA","BREE","AFTON","TEODORA","TAMIE","SHENA",
|
||||||
|
"MEG","LINH","KELI","KACI","DANYELLE","BRITT","ARLETTE","ALBERTINE","ADELLE","TIFFINY","STORMY","SIMONA","NUMBERS","NICOLASA",
|
||||||
|
"NICHOL","NIA","NAKISHA","MEE","MAIRA","LOREEN","KIZZY","JOHNNY","JAY","FALLON","CHRISTENE","BOBBYE","ANTHONY","YING","VINCENZA",
|
||||||
|
"TANJA","RUBIE","RONI","QUEENIE","MARGARETT","KIMBERLI","IRMGARD","IDELL","HILMA","EVELINA","ESTA","EMILEE","DENNISE","DANIA",
|
||||||
|
"CARL","CARIE","ANTONIO","WAI","SANG","RISA","RIKKI","PARTICIA","MUI","MASAKO","MARIO","LUVENIA","LOREE","LONI","LIEN","KEVIN",
|
||||||
|
"GIGI","FLORENCIA","DORIAN","DENITA","DALLAS","CHI","BILLYE","ALEXANDER","TOMIKA","SHARITA","RANA","NIKOLE","NEOMA","MARGARITE",
|
||||||
|
"MADALYN","LUCINA","LAILA","KALI","JENETTE","GABRIELE","EVELYNE","ELENORA","CLEMENTINA","ALEJANDRINA","ZULEMA","VIOLETTE",
|
||||||
|
"VANNESSA","THRESA","RETTA","PIA","PATIENCE","NOELLA","NICKIE","JONELL","DELTA","CHUNG","CHAYA","CAMELIA","BETHEL","ANYA",
|
||||||
|
"ANDREW","THANH","SUZANN","SPRING","SHU","MILA","LILLA","LAVERNA","KEESHA","KATTIE","GIA","GEORGENE","EVELINE","ESTELL","ELIZBETH",
|
||||||
|
"VIVIENNE","VALLIE","TRUDIE","STEPHANE","MICHEL","MAGALY","MADIE","KENYETTA","KARREN","JANETTA","HERMINE","HARMONY","DRUCILLA",
|
||||||
|
"DEBBI","CELESTINA","CANDIE","BRITNI","BECKIE","AMINA","ZITA","YUN","YOLANDE","VIVIEN","VERNETTA","TRUDI","SOMMER","PEARLE",
|
||||||
|
"PATRINA","OSSIE","NICOLLE","LOYCE","LETTY","LARISA","KATHARINA","JOSELYN","JONELLE","JENELL","IESHA","HEIDE","FLORINDA",
|
||||||
|
"FLORENTINA","FLO","ELODIA","DORINE","BRUNILDA","BRIGID","ASHLI","ARDELLA","TWANA","THU","TARAH","SUNG","SHEA","SHAVON","SHANE",
|
||||||
|
"SERINA","RAYNA","RAMONITA","NGA","MARGURITE","LUCRECIA","KOURTNEY","KATI","JESUS","JESENIA","DIAMOND","CRISTA","AYANA","ALICA",
|
||||||
|
"ALIA","VINNIE","SUELLEN","ROMELIA","RACHELL","PIPER","OLYMPIA","MICHIKO","KATHALEEN","JOLIE","JESSI","JANESSA","HANA","HA",
|
||||||
|
"ELEASE","CARLETTA","BRITANY","SHONA","SALOME","ROSAMOND","REGENA","RAINA","NGOC","NELIA","LOUVENIA","LESIA","LATRINA","LATICIA",
|
||||||
|
"LARHONDA","JINA","JACKI","HOLLIS","HOLLEY","EMMY","DEEANN","CORETTA","ARNETTA","VELVET","THALIA","SHANICE","NETA","MIKKI","MICKI",
|
||||||
|
"LONNA","LEANA","LASHUNDA","KILEY","JOYE","JACQULYN","IGNACIA","HYUN","HIROKO","HENRY","HENRIETTE","ELAYNE","DELINDA","DARNELL",
|
||||||
|
"DAHLIA","COREEN","CONSUELA","CONCHITA","CELINE","BABETTE","AYANNA","ANETTE","ALBERTINA","SKYE","SHAWNEE","SHANEKA","QUIANA",
|
||||||
|
"PAMELIA","MIN","MERRI","MERLENE","MARGIT","KIESHA","KIERA","KAYLENE","JODEE","JENISE","ERLENE","EMMIE","ELSE","DARYL","DALILA",
|
||||||
|
"DAISEY","CODY","CASIE","BELIA","BABARA","VERSIE","VANESA","SHELBA","SHAWNDA","SAM","NORMAN","NIKIA","NAOMA","MARNA","MARGERET",
|
||||||
|
"MADALINE","LAWANA","KINDRA","JUTTA","JAZMINE","JANETT","HANNELORE","GLENDORA","GERTRUD","GARNETT","FREEDA","FREDERICA","FLORANCE",
|
||||||
|
"FLAVIA","DENNIS","CARLINE","BEVERLEE","ANJANETTE","VALDA","TRINITY","TAMALA","STEVIE","SHONNA","SHA","SARINA","ONEIDA","MICAH",
|
||||||
|
"MERILYN","MARLEEN","LURLINE","LENNA","KATHERIN","JIN","JENI","HAE","GRACIA","GLADY","FARAH","ERIC","ENOLA","EMA","DOMINQUE",
|
||||||
|
"DEVONA","DELANA","CECILA","CAPRICE","ALYSHA","ALI","ALETHIA","VENA","THERESIA","TAWNY","SONG","SHAKIRA","SAMARA","SACHIKO",
|
||||||
|
"RACHELE","PAMELLA","NICKY","MARNI","MARIEL","MAREN","MALISA","LIGIA","LERA","LATORIA","LARAE","KIMBER","KATHERN","KAREY",
|
||||||
|
"JENNEFER","JANETH","HALINA","FREDIA","DELISA","DEBROAH","CIERA","CHIN","ANGELIKA","ANDREE","ALTHA","YEN","VIVAN","TERRESA",
|
||||||
|
"TANNA","SUK","SUDIE","SOO","SIGNE","SALENA","RONNI","REBBECCA","MYRTIE","MCKENZIE","MALIKA","MAIDA","LOAN","LEONARDA","KAYLEIGH",
|
||||||
|
"FRANCE","ETHYL","ELLYN","DAYLE","CAMMIE","BRITTNI","BIRGIT","AVELINA","ASUNCION","ARIANNA","AKIKO","VENICE","TYESHA","TONIE",
|
||||||
|
"TIESHA","TAKISHA","STEFFANIE","SINDY","SANTANA","MEGHANN","MANDA","MACIE","LADY","KELLYE","KELLEE","JOSLYN","JASON","INGER",
|
||||||
|
"INDIRA","GLINDA","GLENNIS","FERNANDA","FAUSTINA","ENEIDA","ELICIA","DOT","DIGNA","DELL","ARLETTA","ANDRE","WILLIA","TAMMARA",
|
||||||
|
"TABETHA","SHERRELL","SARI","REFUGIO","REBBECA","PAULETTA","NIEVES","NATOSHA","NAKITA","MAMMIE","KENISHA","KAZUKO","KASSIE",
|
||||||
|
"GARY","EARLEAN","DAPHINE","CORLISS","CLOTILDE","CAROLYNE","BERNETTA","AUGUSTINA","AUDREA","ANNIS","ANNABELL","YAN","TENNILLE",
|
||||||
|
"TAMICA","SELENE","SEAN","ROSANA","REGENIA","QIANA","MARKITA","MACY","LEEANNE","LAURINE","KYM","JESSENIA","JANITA","GEORGINE",
|
||||||
|
"GENIE","EMIKO","ELVIE","DEANDRA","DAGMAR","CORIE","COLLEN","CHERISH","ROMAINE","PORSHA","PEARLENE","MICHELINE","MERNA","MARGORIE",
|
||||||
|
"MARGARETTA","LORE","KENNETH","JENINE","HERMINA","FREDERICKA","ELKE","DRUSILLA","DORATHY","DIONE","DESIRE","CELENA","BRIGIDA",
|
||||||
|
"ANGELES","ALLEGRA","THEO","TAMEKIA","SYNTHIA","STEPHEN","SOOK","SLYVIA","ROSANN","REATHA","RAYE","MARQUETTA","MARGART","LING",
|
||||||
|
"LAYLA","KYMBERLY","KIANA","KAYLEEN","KATLYN","KARMEN","JOELLA","IRINA","EMELDA","ELENI","DETRA","CLEMMIE","CHERYLL","CHANTELL",
|
||||||
|
"CATHEY","ARNITA","ARLA","ANGLE","ANGELIC","ALYSE","ZOFIA","THOMASINE","TENNIE","SON","SHERLY","SHERLEY","SHARYL","REMEDIOS",
|
||||||
|
"PETRINA","NICKOLE","MYUNG","MYRLE","MOZELLA","LOUANNE","LISHA","LATIA","LANE","KRYSTA","JULIENNE","JOEL","JEANENE","JACQUALINE",
|
||||||
|
"ISAURA","GWENDA","EARLEEN","DONALD","CLEOPATRA","CARLIE","AUDIE","ANTONIETTA","ALISE","ALEX","VERDELL","VAL","TYLER","TOMOKO",
|
||||||
|
"THAO","TALISHA","STEVEN","SO","SHEMIKA","SHAUN","SCARLET","SAVANNA","SANTINA","ROSIA","RAEANN","ODILIA","NANA","MINNA","MAGAN",
|
||||||
|
"LYNELLE","LE","KARMA","JOEANN","IVANA","INELL","ILANA","HYE","HONEY","HEE","GUDRUN","FRANK","DREAMA","CRISSY","CHANTE",
|
||||||
|
"CARMELINA","ARVILLA","ARTHUR","ANNAMAE","ALVERA","ALEIDA","AARON","YEE","YANIRA","VANDA","TIANNA","TAM","STEFANIA","SHIRA",
|
||||||
|
"PERRY","NICOL","NANCIE","MONSERRATE","MINH","MELYNDA","MELANY","MATTHEW","LOVELLA","LAURE","KIRBY","KACY","JACQUELYNN","HYON",
|
||||||
|
"GERTHA","FRANCISCO","ELIANA","CHRISTENA","CHRISTEEN","CHARISE","CATERINA","CARLEY","CANDYCE","ARLENA","AMMIE","YANG","WILLETTE",
|
||||||
|
"VANITA","TUYET","TINY","SYREETA","SILVA","SCOTT","RONALD","PENNEY","NYLA","MICHAL","MAURICE","MARYAM","MARYA","MAGEN","LUDIE",
|
||||||
|
"LOMA","LIVIA","LANELL","KIMBERLIE","JULEE","DONETTA","DIEDRA","DENISHA","DEANE","DAWNE","CLARINE","CHERRYL","BRONWYN","BRANDON",
|
||||||
|
"ALLA","VALERY","TONDA","SUEANN","SORAYA","SHOSHANA","SHELA","SHARLEEN","SHANELLE","NERISSA","MICHEAL","MERIDITH","MELLIE","MAYE",
|
||||||
|
"MAPLE","MAGARET","LUIS","LILI","LEONILA","LEONIE","LEEANNA","LAVONIA","LAVERA","KRISTEL","KATHEY","KATHE","JUSTIN","JULIAN",
|
||||||
|
"JIMMY","JANN","ILDA","HILDRED","HILDEGARDE","GENIA","FUMIKO","EVELIN","ERMELINDA","ELLY","DUNG","DOLORIS","DIONNA","DANAE",
|
||||||
|
"BERNEICE","ANNICE","ALIX","VERENA","VERDIE","TRISTAN","SHAWNNA","SHAWANA","SHAUNNA","ROZELLA","RANDEE","RANAE","MILAGRO",
|
||||||
|
"LYNELL","LUISE","LOUIE","LOIDA","LISBETH","KARLEEN","JUNITA","JONA","ISIS","HYACINTH","HEDY","GWENN","ETHELENE","ERLINE",
|
||||||
|
"EDWARD","DONYA","DOMONIQUE","DELICIA","DANNETTE","CICELY","BRANDA","BLYTHE","BETHANN","ASHLYN","ANNALEE","ALLINE","YUKO","VELLA",
|
||||||
|
"TRANG","TOWANDA","TESHA","SHERLYN","NARCISA","MIGUELINA","MERI","MAYBELL","MARLANA","MARGUERITA","MADLYN","LUNA","LORY",
|
||||||
|
"LORIANN","LIBERTY","LEONORE","LEIGHANN","LAURICE","LATESHA","LARONDA","KATRICE","KASIE","KARL","KALEY","JADWIGA","GLENNIE",
|
||||||
|
"GEARLDINE","FRANCINA","EPIFANIA","DYAN","DORIE","DIEDRE","DENESE","DEMETRICE","DELENA","DARBY","CRISTIE","CLEORA","CATARINA",
|
||||||
|
"CARISA","BERNIE","BARBERA","ALMETA","TRULA","TEREASA","SOLANGE","SHEILAH","SHAVONNE","SANORA","ROCHELL","MATHILDE","MARGARETA",
|
||||||
|
"MAIA","LYNSEY","LAWANNA","LAUNA","KENA","KEENA","KATIA","JAMEY","GLYNDA","GAYLENE","ELVINA","ELANOR","DANUTA","DANIKA","CRISTEN",
|
||||||
|
"CORDIE","COLETTA","CLARITA","CARMON","BRYNN","AZUCENA","AUNDREA","ANGELE","YI","WALTER","VERLIE","VERLENE","TAMESHA","SILVANA",
|
||||||
|
"SEBRINA","SAMIRA","REDA","RAYLENE","PENNI","PANDORA","NORAH","NOMA","MIREILLE","MELISSIA","MARYALICE","LARAINE","KIMBERY",
|
||||||
|
"KARYL","KARINE","KAM","JOLANDA","JOHANA","JESUSA","JALEESA","JAE","JACQUELYNE","IRISH","ILUMINADA","HILARIA","HANH","GENNIE",
|
||||||
|
"FRANCIE","FLORETTA","EXIE","EDDA","DREMA","DELPHA","BEV","BARBAR","ASSUNTA","ARDELL","ANNALISA","ALISIA","YUKIKO","YOLANDO",
|
||||||
|
"WONDA","WEI","WALTRAUD","VETA","TEQUILA","TEMEKA","TAMEIKA","SHIRLEEN","SHENITA","PIEDAD","OZELLA","MIRTHA","MARILU","KIMIKO",
|
||||||
|
"JULIANE","JENICE","JEN","JANAY","JACQUILINE","HILDE","FE","FAE","EVAN","EUGENE","ELOIS","ECHO","DEVORAH","CHAU","BRINDA",
|
||||||
|
"BETSEY","ARMINDA","ARACELIS","APRYL","ANNETT","ALISHIA","VEOLA","USHA","TOSHIKO","THEOLA","TASHIA","TALITHA","SHERY","RUDY",
|
||||||
|
"RENETTA","REIKO","RASHEEDA","OMEGA","OBDULIA","MIKA","MELAINE","MEGGAN","MARTIN","MARLEN","MARGET","MARCELINE","MANA","MAGDALEN",
|
||||||
|
"LIBRADA","LEZLIE","LEXIE","LATASHIA","LASANDRA","KELLE","ISIDRA","ISA","INOCENCIA","GWYN","FRANCOISE","ERMINIA","ERINN","DIMPLE",
|
||||||
|
"DEVORA","CRISELDA","ARMANDA","ARIE","ARIANE","ANGELO","ANGELENA","ALLEN","ALIZA","ADRIENE","ADALINE","XOCHITL","TWANNA","TRAN",
|
||||||
|
"TOMIKO","TAMISHA","TAISHA","SUSY","SIU","RUTHA","ROXY","RHONA","RAYMOND","OTHA","NORIKO","NATASHIA","MERRIE","MELVIN","MARINDA",
|
||||||
|
"MARIKO","MARGERT","LORIS","LIZZETTE","LEISHA","KAILA","KA","JOANNIE","JERRICA","JENE","JANNET","JANEE","JACINDA","HERTA",
|
||||||
|
"ELENORE","DORETTA","DELAINE","DANIELL","CLAUDIE","CHINA","BRITTA","APOLONIA","AMBERLY","ALEASE","YURI","YUK","WEN","WANETA",
|
||||||
|
"UTE","TOMI","SHARRI","SANDIE","ROSELLE","REYNALDA","RAGUEL","PHYLICIA","PATRIA","OLIMPIA","ODELIA","MITZIE","MITCHELL","MISS",
|
||||||
|
"MINDA","MIGNON","MICA","MENDY","MARIVEL","MAILE","LYNETTA","LAVETTE","LAURYN","LATRISHA","LAKIESHA","KIERSTEN","KARY","JOSPHINE",
|
||||||
|
"JOLYN","JETTA","JANISE","JACQUIE","IVELISSE","GLYNIS","GIANNA","GAYNELLE","EMERALD","DEMETRIUS","DANYELL","DANILLE","DACIA",
|
||||||
|
"CORALEE","CHER","CEOLA","BRETT","BELL","ARIANNE","ALESHIA","YUNG","WILLIEMAE","TROY","TRINH","THORA","TAI","SVETLANA","SHERIKA",
|
||||||
|
"SHEMEKA","SHAUNDA","ROSELINE","RICKI","MELDA","MALLIE","LAVONNA","LATINA","LARRY","LAQUANDA","LALA","LACHELLE","KLARA","KANDIS",
|
||||||
|
"JOHNA","JEANMARIE","JAYE","HANG","GRAYCE","GERTUDE","EMERITA","EBONIE","CLORINDA","CHING","CHERY","CAROLA","BREANN","BLOSSOM",
|
||||||
|
"BERNARDINE","BECKI","ARLETHA","ARGELIA","ARA","ALITA","YULANDA","YON","YESSENIA","TOBI","TASIA","SYLVIE","SHIRL","SHIRELY",
|
||||||
|
"SHERIDAN","SHELLA","SHANTELLE","SACHA","ROYCE","REBECKA","REAGAN","PROVIDENCIA","PAULENE","MISHA","MIKI","MARLINE","MARICA",
|
||||||
|
"LORITA","LATOYIA","LASONYA","KERSTIN","KENDA","KEITHA","KATHRIN","JAYMIE","JACK","GRICELDA","GINETTE","ERYN","ELINA","ELFRIEDA",
|
||||||
|
"DANYEL","CHEREE","CHANELLE","BARRIE","AVERY","AURORE","ANNAMARIA","ALLEEN","AILENE","AIDE","YASMINE","VASHTI","VALENTINE",
|
||||||
|
"TREASA","TORY","TIFFANEY","SHERYLL","SHARIE","SHANAE","SAU","RAISA","PA","NEDA","MITSUKO","MIRELLA","MILDA","MARYANNA","MARAGRET",
|
||||||
|
"MABELLE","LUETTA","LORINA","LETISHA","LATARSHA","LANELLE","LAJUANA","KRISSY","KARLY","KARENA","JON","JESSIKA","JERICA","JEANELLE",
|
||||||
|
"JANUARY","JALISA","JACELYN","IZOLA","IVEY","GREGORY","EUNA","ETHA","DREW","DOMITILA","DOMINICA","DAINA","CREOLA","CARLI","CAMIE",
|
||||||
|
"BUNNY","BRITTNY","ASHANTI","ANISHA","ALEEN","ADAH","YASUKO","WINTER","VIKI","VALRIE","TONA","TINISHA","THI","TERISA","TATUM",
|
||||||
|
"TANEKA","SIMONNE","SHALANDA","SERITA","RESSIE","REFUGIA","PAZ","OLENE","NA","MERRILL","MARGHERITA","MANDIE","MAN","MAIRE",
|
||||||
|
"LYNDIA","LUCI","LORRIANE","LORETA","LEONIA","LAVONA","LASHAWNDA","LAKIA","KYOKO","KRYSTINA","KRYSTEN","KENIA","KELSI","JUDE",
|
||||||
|
"JEANICE","ISOBEL","GEORGIANN","GENNY","FELICIDAD","EILENE","DEON","DELOISE","DEEDEE","DANNIE","CONCEPTION","CLORA","CHERILYN",
|
||||||
|
"CHANG","CALANDRA","BERRY","ARMANDINA","ANISA","ULA","TIMOTHY","TIERA","THERESSA","STEPHANIA","SIMA","SHYLA","SHONTA","SHERA",
|
||||||
|
"SHAQUITA","SHALA","SAMMY","ROSSANA","NOHEMI","NERY","MORIAH","MELITA","MELIDA","MELANI","MARYLYNN","MARISHA","MARIETTE","MALORIE",
|
||||||
|
"MADELENE","LUDIVINA","LORIA","LORETTE","LORALEE","LIANNE","LEON","LAVENIA","LAURINDA","LASHON","KIT","KIMI","KEILA","KATELYNN",
|
||||||
|
"KAI","JONE","JOANE","JI","JAYNA","JANELLA","JA","HUE","HERTHA","FRANCENE","ELINORE","DESPINA","DELSIE","DEEDRA","CLEMENCIA",
|
||||||
|
"CARRY","CAROLIN","CARLOS","BULAH","BRITTANIE","BOK","BLONDELL","BIBI","BEAULAH","BEATA","ANNITA","AGRIPINA","VIRGEN","VALENE",
|
||||||
|
"UN","TWANDA","TOMMYE","TOI","TARRA","TARI","TAMMERA","SHAKIA","SADYE","RUTHANNE","ROCHEL","RIVKA","PURA","NENITA","NATISHA",
|
||||||
|
"MING","MERRILEE","MELODEE","MARVIS","LUCILLA","LEENA","LAVETA","LARITA","LANIE","KEREN","ILEEN","GEORGEANN","GENNA","GENESIS",
|
||||||
|
"FRIDA","EWA","EUFEMIA","EMELY","ELA","EDYTH","DEONNA","DEADRA","DARLENA","CHANELL","CHAN","CATHERN","CASSONDRA","CASSAUNDRA",
|
||||||
|
"BERNARDA","BERNA","ARLINDA","ANAMARIA","ALBERT","WESLEY","VERTIE","VALERI","TORRI","TATYANA","STASIA","SHERISE","SHERILL",
|
||||||
|
"SEASON","SCOTTIE","SANDA","RUTHE","ROSY","ROBERTO","ROBBI","RANEE","QUYEN","PEARLY","PALMIRA","ONITA","NISHA","NIESHA","NIDA",
|
||||||
|
"NEVADA","NAM","MERLYN","MAYOLA","MARYLOUISE","MARYLAND","MARX","MARTH","MARGENE","MADELAINE","LONDA","LEONTINE","LEOMA","LEIA",
|
||||||
|
"LAWRENCE","LAURALEE","LANORA","LAKITA","KIYOKO","KETURAH","KATELIN","KAREEN","JONIE","JOHNETTE","JENEE","JEANETT","IZETTA",
|
||||||
|
"HIEDI","HEIKE","HASSIE","HAROLD","GIUSEPPINA","GEORGANN","FIDELA","FERNANDE","ELWANDA","ELLAMAE","ELIZ","DUSTI","DOTTY","CYNDY",
|
||||||
|
"CORALIE","CELESTA","ARGENTINA","ALVERTA","XENIA","WAVA","VANETTA","TORRIE","TASHINA","TANDY","TAMBRA","TAMA","STEPANIE","SHILA",
|
||||||
|
"SHAUNTA","SHARAN","SHANIQUA","SHAE","SETSUKO","SERAFINA","SANDEE","ROSAMARIA","PRISCILA","OLINDA","NADENE","MUOI","MICHELINA",
|
||||||
|
"MERCEDEZ","MARYROSE","MARIN","MARCENE","MAO","MAGALI","MAFALDA","LOGAN","LINN","LANNIE","KAYCE","KAROLINE","KAMILAH","KAMALA",
|
||||||
|
"JUSTA","JOLINE","JENNINE","JACQUETTA","IRAIDA","GERALD","GEORGEANNA","FRANCHESCA","FAIRY","EMELINE","ELANE","EHTEL","EARLIE",
|
||||||
|
"DULCIE","DALENE","CRIS","CLASSIE","CHERE","CHARIS","CAROYLN","CARMINA","CARITA","BRIAN","BETHANIE","AYAKO","ARICA","AN","ALYSA",
|
||||||
|
"ALESSANDRA","AKILAH","ADRIEN","ZETTA","YOULANDA","YELENA","YAHAIRA","XUAN","WENDOLYN","VICTOR","TIJUANA","TERRELL","TERINA",
|
||||||
|
"TERESIA","SUZI","SUNDAY","SHERELL","SHAVONDA","SHAUNTE","SHARDA","SHAKITA","SENA","RYANN","RUBI","RIVA","REGINIA","REA","RACHAL",
|
||||||
|
"PARTHENIA","PAMULA","MONNIE","MONET","MICHAELE","MELIA","MARINE","MALKA","MAISHA","LISANDRA","LEO","LEKISHA","LEAN","LAURENCE",
|
||||||
|
"LAKENDRA","KRYSTIN","KORTNEY","KIZZIE","KITTIE","KERA","KENDAL","KEMBERLY","KANISHA","JULENE","JULE","JOSHUA","JOHANNE","JEFFREY",
|
||||||
|
"JAMEE","HAN","HALLEY","GIDGET","GALINA","FREDRICKA","FLETA","FATIMAH","EUSEBIA","ELZA","ELEONORE","DORTHEY","DORIA","DONELLA",
|
||||||
|
"DINORAH","DELORSE","CLARETHA","CHRISTINIA","CHARLYN","BONG","BELKIS","AZZIE","ANDERA","AIKO","ADENA","YER","YAJAIRA","WAN",
|
||||||
|
"VANIA","ULRIKE","TOSHIA","TIFANY","STEFANY","SHIZUE","SHENIKA","SHAWANNA","SHAROLYN","SHARILYN","SHAQUANA","SHANTAY","SEE",
|
||||||
|
"ROZANNE","ROSELEE","RICKIE","REMONA","REANNA","RAELENE","QUINN","PHUNG","PETRONILA","NATACHA","NANCEY","MYRL","MIYOKO","MIESHA",
|
||||||
|
"MERIDETH","MARVELLA","MARQUITTA","MARHTA","MARCHELLE","LIZETH","LIBBIE","LAHOMA","LADAWN","KINA","KATHELEEN","KATHARYN","KARISA",
|
||||||
|
"KALEIGH","JUNIE","JULIEANN","JOHNSIE","JANEAN","JAIMEE","JACKQUELINE","HISAKO","HERMA","HELAINE","GWYNETH","GLENN","GITA",
|
||||||
|
"EUSTOLIA","EMELINA","ELIN","EDRIS","DONNETTE","DONNETTA","DIERDRE","DENAE","DARCEL","CLAUDE","CLARISA","CINDERELLA","CHIA",
|
||||||
|
"CHARLESETTA","CHARITA","CELSA","CASSY","CASSI","CARLEE","BRUNA","BRITTANEY","BRANDE","BILLI","BAO","ANTONETTA","ANGLA","ANGELYN",
|
||||||
|
"ANALISA","ALANE","WENONA","WENDIE","VERONIQUE","VANNESA","TOBIE","TEMPIE","SUMIKO","SULEMA","SPARKLE","SOMER","SHEBA","SHAYNE",
|
||||||
|
"SHARICE","SHANEL","SHALON","SAGE","ROY","ROSIO","ROSELIA","RENAY","REMA","REENA","PORSCHE","PING","PEG","OZIE","ORETHA","ORALEE",
|
||||||
|
"ODA","NU","NGAN","NAKESHA","MILLY","MARYBELLE","MARLIN","MARIS","MARGRETT","MARAGARET","MANIE","LURLENE","LILLIA","LIESELOTTE",
|
||||||
|
"LAVELLE","LASHAUNDA","LAKEESHA","KEITH","KAYCEE","KALYN","JOYA","JOETTE","JENAE","JANIECE","ILLA","GRISEL","GLAYDS","GENEVIE",
|
||||||
|
"GALA","FREDDA","FRED","ELMER","ELEONOR","DEBERA","DEANDREA","DAN","CORRINNE","CORDIA","CONTESSA","COLENE","CLEOTILDE","CHARLOTT",
|
||||||
|
"CHANTAY","CECILLE","BEATRIS","AZALEE","ARLEAN","ARDATH","ANJELICA","ANJA","ALFREDIA","ALEISHA","ADAM","ZADA","YUONNE","XIAO",
|
||||||
|
"WILLODEAN","WHITLEY","VENNIE","VANNA","TYISHA","TOVA","TORIE","TONISHA","TILDA","TIEN","TEMPLE","SIRENA","SHERRIL","SHANTI",
|
||||||
|
"SHAN","SENAIDA","SAMELLA","ROBBYN","RENDA","REITA","PHEBE","PAULITA","NOBUKO","NGUYET","NEOMI","MOON","MIKAELA","MELANIA",
|
||||||
|
"MAXIMINA","MARG","MAISIE","LYNNA","LILLI","LAYNE","LASHAUN","LAKENYA","LAEL","KIRSTIE","KATHLINE","KASHA","KARLYN","KARIMA",
|
||||||
|
"JOVAN","JOSEFINE","JENNELL","JACQUI","JACKELYN","HYO","HIEN","GRAZYNA","FLORRIE","FLORIA","ELEONORA","DWANA","DORLA","DONG",
|
||||||
|
"DELMY","DEJA","DEDE","DANN","CRYSTA","CLELIA","CLARIS","CLARENCE","CHIEKO","CHERLYN","CHERELLE","CHARMAIN","CHARA","CAMMY","BEE",
|
||||||
|
"ARNETTE","ARDELLE","ANNIKA","AMIEE","AMEE","ALLENA","YVONE","YUKI","YOSHIE","YEVETTE","YAEL","WILLETTA","VONCILE","VENETTA",
|
||||||
|
"TULA","TONETTE","TIMIKA","TEMIKA","TELMA","TEISHA","TAREN","TA","STACEE","SHIN","SHAWNTA","SATURNINA","RICARDA","POK","PASTY",
|
||||||
|
"ONIE","NUBIA","MORA","MIKE","MARIELLE","MARIELLA","MARIANELA","MARDELL","MANY","LUANNA","LOISE","LISABETH","LINDSY","LILLIANA",
|
||||||
|
"LILLIAM","LELAH","LEIGHA","LEANORA","LANG","KRISTEEN","KHALILAH","KEELEY","KANDRA","JUNKO","JOAQUINA","JERLENE","JANI","JAMIKA",
|
||||||
|
"JAME","HSIU","HERMILA","GOLDEN","GENEVIVE","EVIA","EUGENA","EMMALINE","ELFREDA","ELENE","DONETTE","DELCIE","DEEANNA","DARCEY",
|
||||||
|
"CUC","CLARINDA","CIRA","CHAE","CELINDA","CATHERYN","CATHERIN","CASIMIRA","CARMELIA","CAMELLIA","BREANA","BOBETTE","BERNARDINA",
|
||||||
|
"BEBE","BASILIA","ARLYNE","AMAL","ALAYNA","ZONIA","ZENIA","YURIKO","YAEKO","WYNELL","WILLOW","WILLENA","VERNIA","TU","TRAVIS",
|
||||||
|
"TORA","TERRILYN","TERICA","TENESHA","TAWNA","TAJUANA","TAINA","STEPHNIE","SONA","SOL","SINA","SHONDRA","SHIZUKO","SHERLENE",
|
||||||
|
"SHERICE","SHARIKA","ROSSIE","ROSENA","RORY","RIMA","RIA","RHEBA","RENNA","PETER","NATALYA","NANCEE","MELODI","MEDA","MAXIMA",
|
||||||
|
"MATHA","MARKETTA","MARICRUZ","MARCELENE","MALVINA","LUBA","LOUETTA","LEIDA","LECIA","LAURAN","LASHAWNA","LAINE","KHADIJAH",
|
||||||
|
"KATERINE","KASI","KALLIE","JULIETTA","JESUSITA","JESTINE","JESSIA","JEREMY","JEFFIE","JANYCE","ISADORA","GEORGIANNE","FIDELIA",
|
||||||
|
"EVITA","EURA","EULAH","ESTEFANA","ELSY","ELIZABET","ELADIA","DODIE","DION","DIA","DENISSE","DELORAS","DELILA","DAYSI","DAKOTA",
|
||||||
|
"CURTIS","CRYSTLE","CONCHA","COLBY","CLARETTA","CHU","CHRISTIA","CHARLSIE","CHARLENA","CARYLON","BETTYANN","ASLEY","ASHLEA",
|
||||||
|
"AMIRA","AI","AGUEDA","AGNUS","YUETTE","VINITA","VICTORINA","TYNISHA","TREENA","TOCCARA","TISH","THOMASENA","TEGAN","SOILA",
|
||||||
|
"SHILOH","SHENNA","SHARMAINE","SHANTAE","SHANDI","SEPTEMBER","SARAN","SARAI","SANA","SAMUEL","SALLEY","ROSETTE","ROLANDE","REGINE",
|
||||||
|
"OTELIA","OSCAR","OLEVIA","NICHOLLE","NECOLE","NAIDA","MYRTA","MYESHA","MITSUE","MINTA","MERTIE","MARGY","MAHALIA","MADALENE",
|
||||||
|
"LOVE","LOURA","LOREAN","LEWIS","LESHA","LEONIDA","LENITA","LAVONE","LASHELL","LASHANDRA","LAMONICA","KIMBRA","KATHERINA","KARRY",
|
||||||
|
"KANESHA","JULIO","JONG","JENEVA","JAQUELYN","HWA","GILMA","GHISLAINE","GERTRUDIS","FRANSISCA","FERMINA","ETTIE","ETSUKO","ELLIS",
|
||||||
|
"ELLAN","ELIDIA","EDRA","DORETHEA","DOREATHA","DENYSE","DENNY","DEETTA","DAINE","CYRSTAL","CORRIN","CAYLA","CARLITA","CAMILA",
|
||||||
|
"BURMA","BULA","BUENA","BLAKE","BARABARA","AVRIL","AUSTIN","ALAINE","ZANA","WILHEMINA","WANETTA","VIRGIL","VI","VERONIKA","VERNON",
|
||||||
|
"VERLINE","VASILIKI","TONITA","TISA","TEOFILA","TAYNA","TAUNYA","TANDRA","TAKAKO","SUNNI","SUANNE","SIXTA","SHARELL","SEEMA",
|
||||||
|
"RUSSELL","ROSENDA","ROBENA","RAYMONDE","PEI","PAMILA","OZELL","NEIDA","NEELY","MISTIE","MICHA","MERISSA","MAURITA","MARYLN",
|
||||||
|
"MARYETTA","MARSHALL","MARCELL","MALENA","MAKEDA","MADDIE","LOVETTA","LOURIE","LORRINE","LORILEE","LESTER","LAURENA","LASHAY",
|
||||||
|
"LARRAINE","LAREE","LACRESHA","KRISTLE","KRISHNA","KEVA","KEIRA","KAROLE","JOIE","JINNY","JEANNETTA","JAMA","HEIDY","GILBERTE",
|
||||||
|
"GEMA","FAVIOLA","EVELYNN","ENDA","ELLI","ELLENA","DIVINA","DAGNY","COLLENE","CODI","CINDIE","CHASSIDY","CHASIDY","CATRICE",
|
||||||
|
"CATHERINA","CASSEY","CAROLL","CARLENA","CANDRA","CALISTA","BRYANNA","BRITTENY","BEULA","BARI","AUDRIE","AUDRIA","ARDELIA",
|
||||||
|
"ANNELLE","ANGILA","ALONA","ALLYN","DOUGLAS","ROGER","JONATHAN","RALPH","NICHOLAS","BENJAMIN","BRUCE","HARRY","WAYNE","STEVE",
|
||||||
|
"HOWARD","ERNEST","PHILLIP","TODD","CRAIG","ALAN","PHILIP","EARL","DANNY","BRYAN","STANLEY","LEONARD","NATHAN","MANUEL","RODNEY",
|
||||||
|
"MARVIN","VINCENT","JEFFERY","JEFF","CHAD","JACOB","ALFRED","BRADLEY","HERBERT","FREDERICK","EDWIN","DON","RICKY","RANDALL",
|
||||||
|
"BARRY","BERNARD","LEROY","MARCUS","THEODORE","CLIFFORD","MIGUEL","JIM","TOM","CALVIN","BILL","LLOYD","DEREK","WARREN","DARRELL",
|
||||||
|
"JEROME","FLOYD","ALVIN","TIM","GORDON","GREG","JORGE","DUSTIN","PEDRO","DERRICK","ZACHARY","HERMAN","GLEN","HECTOR","RICARDO",
|
||||||
|
"RICK","BRENT","RAMON","GILBERT","MARC","REGINALD","RUBEN","NATHANIEL","RAFAEL","EDGAR","MILTON","RAUL","BEN","CHESTER","DUANE",
|
||||||
|
"FRANKLIN","BRAD","RON","ROLAND","ARNOLD","HARVEY","JARED","ERIK","DARRYL","NEIL","JAVIER","FERNANDO","CLINTON","TED","MATHEW",
|
||||||
|
"TYRONE","DARREN","LANCE","KURT","ALLAN","NELSON","GUY","CLAYTON","HUGH","MAX","DWAYNE","DWIGHT","ARMANDO","FELIX","EVERETT",
|
||||||
|
"IAN","WALLACE","KEN","BOB","ALFREDO","ALBERTO","DAVE","IVAN","BYRON","ISAAC","MORRIS","CLIFTON","WILLARD","ROSS","ANDY",
|
||||||
|
"SALVADOR","KIRK","SERGIO","SETH","KENT","TERRANCE","EDUARDO","TERRENCE","ENRIQUE","WADE","STUART","FREDRICK","ARTURO","ALEJANDRO",
|
||||||
|
"NICK","LUTHER","WENDELL","JEREMIAH","JULIUS","OTIS","TREVOR","OLIVER","LUKE","HOMER","GERARD","DOUG","KENNY","HUBERT","LYLE",
|
||||||
|
"MATT","ALFONSO","ORLANDO","REX","CARLTON","ERNESTO","NEAL","PABLO","LORENZO","OMAR","WILBUR","GRANT","HORACE","RODERICK",
|
||||||
|
"ABRAHAM","WILLIS","RICKEY","ANDRES","CESAR","JOHNATHAN","MALCOLM","RUDOLPH","DAMON","KELVIN","PRESTON","ALTON","ARCHIE","MARCO",
|
||||||
|
"WM","PETE","RANDOLPH","GARRY","GEOFFREY","JONATHON","FELIPE","GERARDO","ED","DOMINIC","DELBERT","COLIN","GUILLERMO","EARNEST",
|
||||||
|
"LUCAS","BENNY","SPENCER","RODOLFO","MYRON","EDMUND","GARRETT","SALVATORE","CEDRIC","LOWELL","GREGG","SHERMAN","WILSON",
|
||||||
|
"SYLVESTER","ROOSEVELT","ISRAEL","JERMAINE","FORREST","WILBERT","LELAND","SIMON","CLARK","IRVING","BRYANT","OWEN","RUFUS",
|
||||||
|
"WOODROW","KRISTOPHER","MACK","LEVI","MARCOS","GUSTAVO","JAKE","LIONEL","GILBERTO","CLINT","NICOLAS","ISMAEL","ORVILLE","ERVIN",
|
||||||
|
"DEWEY","AL","WILFRED","JOSH","HUGO","IGNACIO","CALEB","TOMAS","SHELDON","ERICK","STEWART","DOYLE","DARREL","ROGELIO","TERENCE",
|
||||||
|
"SANTIAGO","ALONZO","ELIAS","BERT","ELBERT","RAMIRO","CONRAD","NOAH","GRADY","PHIL","CORNELIUS","LAMAR","ROLANDO","CLAY","PERCY",
|
||||||
|
"DEXTER","BRADFORD","DARIN","AMOS","MOSES","IRVIN","SAUL","ROMAN","RANDAL","TIMMY","DARRIN","WINSTON","BRENDAN","ABEL","DOMINICK",
|
||||||
|
"BOYD","EMILIO","ELIJAH","DOMINGO","EMMETT","MARLON","EMANUEL","JERALD","EDMOND","EMIL","DEWAYNE","WILL","OTTO","TEDDY",
|
||||||
|
"REYNALDO","BRET","JESS","TRENT","HUMBERTO","EMMANUEL","STEPHAN","VICENTE","LAMONT","GARLAND","MILES","EFRAIN","HEATH","RODGER",
|
||||||
|
"HARLEY","ETHAN","ELDON","ROCKY","PIERRE","JUNIOR","FREDDY","ELI","BRYCE","ANTOINE","STERLING","CHASE","GROVER","ELTON",
|
||||||
|
"CLEVELAND","DYLAN","CHUCK","DAMIAN","REUBEN","STAN","AUGUST","LEONARDO","JASPER","RUSSEL","ERWIN","BENITO","HANS","MONTE",
|
||||||
|
"BLAINE","ERNIE","CURT","QUENTIN","AGUSTIN","MURRAY","JAMAL","ADOLFO","HARRISON","TYSON","BURTON","BRADY","ELLIOTT","WILFREDO",
|
||||||
|
"BART","JARROD","VANCE","DENIS","DAMIEN","JOAQUIN","HARLAN","DESMOND","ELLIOT","DARWIN","GREGORIO","BUDDY","XAVIER","KERMIT",
|
||||||
|
"ROSCOE","ESTEBAN","ANTON","SOLOMON","SCOTTY","NORBERT","ELVIN","WILLIAMS","NOLAN","ROD","QUINTON","HAL","BRAIN","ROB","ELWOOD",
|
||||||
|
"KENDRICK","DARIUS","MOISES","FIDEL","THADDEUS","CLIFF","MARCEL","JACKSON","RAPHAEL","BRYON","ARMAND","ALVARO","JEFFRY","DANE",
|
||||||
|
"JOESPH","THURMAN","NED","RUSTY","MONTY","FABIAN","REGGIE","MASON","GRAHAM","ISAIAH","VAUGHN","GUS","LOYD","DIEGO","ADOLPH",
|
||||||
|
"NORRIS","MILLARD","ROCCO","GONZALO","DERICK","RODRIGO","WILEY","RIGOBERTO","ALPHONSO","TY","NOE","VERN","REED","JEFFERSON",
|
||||||
|
"ELVIS","BERNARDO","MAURICIO","HIRAM","DONOVAN","BASIL","RILEY","NICKOLAS","MAYNARD","SCOT","VINCE","QUINCY","EDDY","SEBASTIAN",
|
||||||
|
"FEDERICO","ULYSSES","HERIBERTO","DONNELL","COLE","DAVIS","GAVIN","EMERY","WARD","ROMEO","JAYSON","DANTE","CLEMENT","COY",
|
||||||
|
"MAXWELL","JARVIS","BRUNO","ISSAC","DUDLEY","BROCK","SANFORD","CARMELO","BARNEY","NESTOR","STEFAN","DONNY","ART","LINWOOD","BEAU",
|
||||||
|
"WELDON","GALEN","ISIDRO","TRUMAN","DELMAR","JOHNATHON","SILAS","FREDERIC","DICK","IRWIN","MERLIN","CHARLEY","MARCELINO","HARRIS",
|
||||||
|
"CARLO","TRENTON","KURTIS","HUNTER","AURELIO","WINFRED","VITO","COLLIN","DENVER","CARTER","LEONEL","EMORY","PASQUALE","MOHAMMAD",
|
||||||
|
"MARIANO","DANIAL","LANDON","DIRK","BRANDEN","ADAN","BUFORD","GERMAN","WILMER","EMERSON","ZACHERY","FLETCHER","JACQUES","ERROL",
|
||||||
|
"DALTON","MONROE","JOSUE","EDWARDO","BOOKER","WILFORD","SONNY","SHELTON","CARSON","THERON","RAYMUNDO","DAREN","HOUSTON","ROBBY",
|
||||||
|
"LINCOLN","GENARO","BENNETT","OCTAVIO","CORNELL","HUNG","ARRON","ANTONY","HERSCHEL","GIOVANNI","GARTH","CYRUS","CYRIL","RONNY",
|
||||||
|
"LON","FREEMAN","DUNCAN","KENNITH","CARMINE","ERICH","CHADWICK","WILBURN","RUSS","REID","MYLES","ANDERSON","MORTON","JONAS",
|
||||||
|
"FOREST","MITCHEL","MERVIN","ZANE","RICH","JAMEL","LAZARO","ALPHONSE","RANDELL","MAJOR","JARRETT","BROOKS","ABDUL","LUCIANO",
|
||||||
|
"SEYMOUR","EUGENIO","MOHAMMED","VALENTIN","CHANCE","ARNULFO","LUCIEN","FERDINAND","THAD","EZRA","ALDO","RUBIN","ROYAL","MITCH",
|
||||||
|
"EARLE","ABE","WYATT","MARQUIS","LANNY","KAREEM","JAMAR","BORIS","ISIAH","EMILE","ELMO","ARON","LEOPOLDO","EVERETTE","JOSEF",
|
||||||
|
"ELOY","RODRICK","REINALDO","LUCIO","JERROD","WESTON","HERSHEL","BARTON","PARKER","LEMUEL","BURT","JULES","GIL","ELISEO","AHMAD",
|
||||||
|
"NIGEL","EFREN","ANTWAN","ALDEN","MARGARITO","COLEMAN","DINO","OSVALDO","LES","DEANDRE","NORMAND","KIETH","TREY","NORBERTO",
|
||||||
|
"NAPOLEON","JEROLD","FRITZ","ROSENDO","MILFORD","CHRISTOPER","ALFONZO","LYMAN","JOSIAH","BRANT","WILTON","RICO","JAMAAL","DEWITT",
|
||||||
|
"BRENTON","OLIN","FOSTER","FAUSTINO","CLAUDIO","JUDSON","GINO","EDGARDO","ALEC","TANNER","JARRED","DONN","TAD","PRINCE","PORFIRIO",
|
||||||
|
"ODIS","LENARD","CHAUNCEY","TOD","MEL","MARCELO","KORY","AUGUSTUS","KEVEN","HILARIO","BUD","SAL","ORVAL","MAURO","ZACHARIAH",
|
||||||
|
"OLEN","ANIBAL","MILO","JED","DILLON","AMADO","NEWTON","LENNY","RICHIE","HORACIO","BRICE","MOHAMED","DELMER","DARIO","REYES","MAC",
|
||||||
|
"JONAH","JERROLD","ROBT","HANK","RUPERT","ROLLAND","KENTON","DAMION","ANTONE","WALDO","FREDRIC","BRADLY","KIP","BURL","WALKER",
|
||||||
|
"TYREE","JEFFEREY","AHMED","WILLY","STANFORD","OREN","NOBLE","MOSHE","MIKEL","ENOCH","BRENDON","QUINTIN","JAMISON","FLORENCIO",
|
||||||
|
"DARRICK","TOBIAS","HASSAN","GIUSEPPE","DEMARCUS","CLETUS","TYRELL","LYNDON","KEENAN","WERNER","GERALDO","COLUMBUS","CHET",
|
||||||
|
"BERTRAM","MARKUS","HUEY","HILTON","DWAIN","DONTE","TYRON","OMER","ISAIAS","HIPOLITO","FERMIN","ADALBERTO","BO","BARRETT",
|
||||||
|
"TEODORO","MCKINLEY","MAXIMO","GARFIELD","RALEIGH","LAWERENCE","ABRAM","RASHAD","KING","EMMITT","DARON","SAMUAL","MIQUEL",
|
||||||
|
"EUSEBIO","DOMENIC","DARRON","BUSTER","WILBER","RENATO","JC","HOYT","HAYWOOD","EZEKIEL","CHAS","FLORENTINO","ELROY","CLEMENTE",
|
||||||
|
"ARDEN","NEVILLE","EDISON","DESHAWN","NATHANIAL","JORDON","DANILO","CLAUD","SHERWOOD","RAYMON","RAYFORD","CRISTOBAL","AMBROSE",
|
||||||
|
"TITUS","HYMAN","FELTON","EZEQUIEL","ERASMO","STANTON","LONNY","LEN","IKE","MILAN","LINO","JAROD","HERB","ANDREAS","WALTON",
|
||||||
|
"RHETT","PALMER","DOUGLASS","CORDELL","OSWALDO","ELLSWORTH","VIRGILIO","TONEY","NATHANAEL","DEL","BENEDICT","MOSE","JOHNSON",
|
||||||
|
"ISREAL","GARRET","FAUSTO","ASA","ARLEN","ZACK","WARNER","MODESTO","FRANCESCO","MANUAL","GAYLORD","GASTON","FILIBERTO","DEANGELO",
|
||||||
|
"MICHALE","GRANVILLE","WES","MALIK","ZACKARY","TUAN","ELDRIDGE","CRISTOPHER","CORTEZ","ANTIONE","MALCOM","LONG","KOREY","JOSPEH",
|
||||||
|
"COLTON","WAYLON","VON","HOSEA","SHAD","SANTO","RUDOLF","ROLF","REY","RENALDO","MARCELLUS","LUCIUS","KRISTOFER","BOYCE","BENTON",
|
||||||
|
"HAYDEN","HARLAND","ARNOLDO","RUEBEN","LEANDRO","KRAIG","JERRELL","JEROMY","HOBERT","CEDRICK","ARLIE","WINFORD","WALLY","LUIGI",
|
||||||
|
"KENETH","JACINTO","GRAIG","FRANKLYN","EDMUNDO","SID","PORTER","LEIF","JERAMY","BUCK","WILLIAN","VINCENZO","SHON","LYNWOOD","JERE",
|
||||||
|
"HAI","ELDEN","DORSEY","DARELL","BRODERICK","ALONSO"]
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("What is the total of all the name scores in this file?")
|
||||||
|
self.sums = [] #Holds the score based on the sum of the characters in the name
|
||||||
|
self.prod = [] #Holds the score based on the sum of the characters and the location in alphabetical order
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
|
||||||
|
#Sort all the names
|
||||||
|
self.__names.sort()
|
||||||
|
#Step through every name adding up the values of the characters
|
||||||
|
for nameCnt in range(0, len(self.__names)):
|
||||||
|
#Step through every character in the current name adding up the value of the characters
|
||||||
|
self.sums.append(0)
|
||||||
|
for charCnt in range(0, len(self.__names[nameCnt])):
|
||||||
|
#A = 65 so subtracting 64 means A - 1. This will only work correctly if all letters are capitalized
|
||||||
|
self.sums[nameCnt] += (ord(self.__names[nameCnt][charCnt]) - 64)
|
||||||
|
|
||||||
|
#Get the product for all numbers
|
||||||
|
for cnt in range(0, len(self.sums)):
|
||||||
|
self.prod.append(self.sums[cnt] * (cnt + 1))
|
||||||
|
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The answer to the question is " + str(sum(self.prod))
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.sums.clear()
|
||||||
|
self.prod.clear()
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the vecot of the names being scored
|
||||||
|
def getNames(self) -> list:
|
||||||
|
return self.__names
|
||||||
|
#Returns the sum of the names scores
|
||||||
|
def getNameScoreSum(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the sum")
|
||||||
|
return sum(self.prod)
|
||||||
|
|
||||||
|
#This ensures the correct function is called if this is called as a stand along script
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem22()
|
||||||
|
print(problem.getDescription()) #Print the description
|
||||||
|
problem.solve() #Call the function that answers the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
""" Results:
|
||||||
|
The answer to the question is 871198282
|
||||||
|
It took 9.206 milliseconds to run this algorithm
|
||||||
|
"""
|
||||||
128
Problems/Problem23.py
Normal file
128
Problems/Problem23.py
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
#ProjectEuler/Python/Problem23.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 03-22-19
|
||||||
|
#Modified: 07-19-20
|
||||||
|
#Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers
|
||||||
|
#All of my imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
import Algorithms
|
||||||
|
|
||||||
|
|
||||||
|
class Problem23(Problem):
|
||||||
|
#Variables
|
||||||
|
__maxNum = 28123
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers")
|
||||||
|
self.divisorSums = []
|
||||||
|
self.reserveArray()
|
||||||
|
self.sum = 0
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
|
||||||
|
#Get the sum of the divisors of all numbers < __maxNum
|
||||||
|
for cnt in range(1, self.__maxNum):
|
||||||
|
div = Algorithms.getDivisors(cnt)
|
||||||
|
if(len(div) > 1):
|
||||||
|
div.remove(div[len(div) - 1])
|
||||||
|
self.divisorSums[cnt] = sum(div)
|
||||||
|
|
||||||
|
#Get the abundant numbers
|
||||||
|
abund = []
|
||||||
|
for cnt in range(0, len(self.divisorSums)):
|
||||||
|
if(self.divisorSums[cnt] > cnt):
|
||||||
|
abund.append(cnt)
|
||||||
|
|
||||||
|
#Check if each number can be the sum of 2 abundant numbers and add to the sum if no
|
||||||
|
self.sum = 0
|
||||||
|
for cnt in range(1, self.__maxNum):
|
||||||
|
if(not self.isSum(abund, cnt)):
|
||||||
|
self.sum += cnt
|
||||||
|
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The answer is " + str(self.sum)
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reserve the size of the array to speed up insertion
|
||||||
|
def reserveArray(self):
|
||||||
|
#Make sure every element has a 0 in it's location
|
||||||
|
for cnt in range(0, self.__maxNum):
|
||||||
|
self.divisorSums.append(0)
|
||||||
|
#A function that returns true if num can be created by adding two elements from abund and false if it cannot
|
||||||
|
def isSum(self, abund: list, num: int) -> bool:
|
||||||
|
sumOfNums = 0
|
||||||
|
#Pick a number for the first part of the sum
|
||||||
|
for firstNum in range(0, len(abund)):
|
||||||
|
#Pick a number for the second part of the sum
|
||||||
|
for secondNum in range(0, len(abund)):
|
||||||
|
sumOfNums = abund[firstNum] + abund[secondNum]
|
||||||
|
if(sumOfNums == num):
|
||||||
|
return True
|
||||||
|
elif(sumOfNums > num):
|
||||||
|
break
|
||||||
|
#If you have run through the entire list and did not find a sum then it is false
|
||||||
|
return False
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.divisorSums.clear()
|
||||||
|
self.reserveArray()
|
||||||
|
self.sum = 0
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the sum of the numbers asked for
|
||||||
|
def getSum(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the sum")
|
||||||
|
return self.sum
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem23()
|
||||||
|
print(problem.getDescription()) #Print the description
|
||||||
|
problem.solve() #Call the function that answers the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
""" Results:
|
||||||
|
The answer is 4179871
|
||||||
|
It took 27.738 minutes to run this algorithm
|
||||||
|
"""
|
||||||
96
Problems/Problem24.py
Normal file
96
Problems/Problem24.py
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
#ProjectEuler/Python/Problem24.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 03-24-19
|
||||||
|
#Modified: 07-19-20
|
||||||
|
#What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
import Algorithms
|
||||||
|
|
||||||
|
|
||||||
|
class Problem24(Problem):
|
||||||
|
#Variables
|
||||||
|
__neededPerm = 1000000 #The number of the permutation that you need
|
||||||
|
__nums = "0123456789" #All of the characters that we need to get the permutations of
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?")
|
||||||
|
self.permutations = []
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Get all permutations of the string
|
||||||
|
permutations = Algorithms.getPermutations(self.__nums)
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The 1 millionth permutation is " + str(permutations[self.__neededPerm - 1])
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.permutations.clear()
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns a list with all of the permutations
|
||||||
|
def getPermutationsList(self) -> list:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the list of permutations")
|
||||||
|
return self.permutations
|
||||||
|
#Returns the requested permutation
|
||||||
|
def getPermutation(self) -> str:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the ")
|
||||||
|
return self.permutations[self.__neededPerm - 1]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#This calls the appropriate functions if the script is called stand alone
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem24()
|
||||||
|
print(problem.getDescription()) #Print the description
|
||||||
|
problem.solve() #Call the function that answers the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
""" Results:
|
||||||
|
The 1 millionth permutation is 2783915460
|
||||||
|
It took 7.363 seconds to run this algorithm
|
||||||
|
"""
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
#ProjectEuler/Python/Problem25.py
|
#ProjectEuler/Python/Problem25.py
|
||||||
#Matthew Ellison
|
#Matthew Ellison
|
||||||
# Created: 03-25-19
|
# Created: 03-25-19
|
||||||
#Modified: 03-28-19
|
#Modified: 07-19-20
|
||||||
#What is the index of the first term in the Fibonacci sequence to contain 1000 digits?
|
#What is the index of the first term in the Fibonacci sequence to contain 1000 digits?
|
||||||
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
"""
|
"""
|
||||||
Copyright (C) 2019 Matthew Ellison
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
@@ -22,35 +22,75 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
from Stopwatch import Stopwatch
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
import Algorithms
|
import Algorithms
|
||||||
|
|
||||||
|
|
||||||
__numDigits = 1000 #The number of digits to calculate up to
|
class Problem25(Problem):
|
||||||
|
#Variables
|
||||||
|
__numDigits = 1000 #The number of digits to calculate up to
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("What is the index of the first term in the Fibonacci sequence to contain 1000 digits?")
|
||||||
|
self.number = 0 #The current Fibonacci number
|
||||||
|
self.index = 2 #The index of the current Fibonacci number just calculated
|
||||||
|
|
||||||
def Problem25():
|
#Operational functions
|
||||||
#Setup the variables
|
#Sovle the problem
|
||||||
number = 0 #The current Fibonacci number
|
def solve(self):
|
||||||
index = 2 #The index of the just calculated Fibonacci number
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
#Move through all Fibonacci numbers until you reach the one with at least __numDigits digits
|
#Start the timer
|
||||||
while(len(str(number)) < __numDigits):
|
self.timer.start()
|
||||||
index += 1 #Increase the index number. Doing this at the beginning keeps the index correct at the end of the loop
|
|
||||||
number = Algorithms.getFib(index) #Calculate the number
|
|
||||||
|
|
||||||
#Print the results
|
#Move through all Fibonacci numbers until you reach the one with at least __numDigits digits
|
||||||
print("The first Fibonacci number with " + str(__numDigits) + " digits is " + str(number))
|
while(len(str(self.number)) < self.__numDigits):
|
||||||
print("Its index is " + str(index))
|
self.index += 1 #Increase the index number. Doing this at the beginning keeps the index correct at the end of the loop
|
||||||
|
self.number = Algorithms.getFib(self.index) #Calculate the number
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The first Fibonacci number with " + str(self.__numDigits) + " digits is " + str(self.number) + "\nIts index is " + str(self.index)
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.number = 0
|
||||||
|
self.index = 2
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the Fibonacci number asked for
|
||||||
|
def getNumber(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the Fibonacci number")
|
||||||
|
return self.number
|
||||||
|
#Returns the index of the requested Fibonacci number
|
||||||
|
def getIndex(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the index of the Fibonacci number")
|
||||||
|
return self.index
|
||||||
|
|
||||||
|
|
||||||
#This runs the appropriate functions if the script is called by itself
|
#This runs the appropriate functions if the script is called by itself
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
timer = Stopwatch()
|
problem = Problem25()
|
||||||
timer.start()
|
print(problem.getDescription()) #Print the description
|
||||||
Problem25()
|
problem.solve() #Call the function that answers the problem
|
||||||
timer.stop()
|
#Print the results
|
||||||
print("It took " + timer.getString() + " to run this algorithm")
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
""" Results:
|
""" Results:
|
||||||
The first Fibonacci number with 1000 digits is 1070066266382758936764980584457396885083683896632151665013235203375314520604694040621889147582489792657804694888177591957484336466672569959512996030461262748092482186144069433051234774442750273781753087579391666192149259186759553966422837148943113074699503439547001985432609723067290192870526447243726117715821825548491120525013201478612965931381792235559657452039506137551467837543229119602129934048260706175397706847068202895486902666185435124521900369480641357447470911707619766945691070098024393439617474103736912503231365532164773697023167755051595173518460579954919410967778373229665796581646513903488154256310184224190259846088000110186255550245493937113651657039447629584714548523425950428582425306083544435428212611008992863795048006894330309773217834864543113205765659868456288616808718693835297350643986297640660000723562917905207051164077614812491885830945940566688339109350944456576357666151619317753792891661581327159616877487983821820492520348473874384736771934512787029218636250627816
|
The first Fibonacci number with 1000 digits is 1070066266382758936764980584457396885083683896632151665013235203375314520604694040621889147582489792657804694888177591957484336466672569959512996030461262748092482186144069433051234774442750273781753087579391666192149259186759553966422837148943113074699503439547001985432609723067290192870526447243726117715821825548491120525013201478612965931381792235559657452039506137551467837543229119602129934048260706175397706847068202895486902666185435124521900369480641357447470911707619766945691070098024393439617474103736912503231365532164773697023167755051595173518460579954919410967778373229665796581646513903488154256310184224190259846088000110186255550245493937113651657039447629584714548523425950428582425306083544435428212611008992863795048006894330309773217834864543113205765659868456288616808718693835297350643986297640660000723562917905207051164077614812491885830945940566688339109350944456576357666151619317753792891661581327159616877487983821820492520348473874384736771934512787029218636250627816
|
||||||
126
Problems/Problem26.py
Normal file
126
Problems/Problem26.py
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
#ProjectEuler/Python/Problem26.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 07-29-19
|
||||||
|
#Modified: 07-19-20
|
||||||
|
#Find the value of d < 1000 for which 1/d contains the longest recurring cycle in its decimal fraction part.
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
import Algorithms
|
||||||
|
|
||||||
|
|
||||||
|
class Problem26(Problem):
|
||||||
|
#Variables
|
||||||
|
__topNumber = 999 #The largest denominator to be checked
|
||||||
|
|
||||||
|
#Function
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("Find the value of d < 1000 for which 1/d contains the longest recurring cycle in its decimal fraction part.")
|
||||||
|
self.longestCycle = 0
|
||||||
|
self.longestNumber = 0
|
||||||
|
|
||||||
|
#Operational function
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Start with 1/2 and find out how long the longest cycle is by checking the remainders
|
||||||
|
#Loop through every number from 2-999 and use it for the denominator
|
||||||
|
for denominator in range(2, self.__topNumber):
|
||||||
|
remainderList = [] #Holds the list of remainders
|
||||||
|
endFound = False #Holds whether we have found an end to the number (either a cycle or a 0 for remainder)
|
||||||
|
cycleFound = False #Holds whether a cycle was detected
|
||||||
|
numerator = 1 #The numerator that will be divided
|
||||||
|
while(not endFound):
|
||||||
|
#Get the remainder after the division
|
||||||
|
remainder = numerator % denominator
|
||||||
|
#Check if the remainder is 0
|
||||||
|
#If it is 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
|
||||||
|
elif remainder in remainderList:
|
||||||
|
endFound = True
|
||||||
|
cycleFound = True
|
||||||
|
#Else add it to the list
|
||||||
|
else:
|
||||||
|
remainderList.append(remainder)
|
||||||
|
|
||||||
|
#Multiply the remainder by 10 to continue finding the next remainder
|
||||||
|
numerator = remainder * 10
|
||||||
|
#If a cycle was found check the size of the list against the largest cycle
|
||||||
|
if(cycleFound):
|
||||||
|
#If it is larger than the largest, set it as the new largest
|
||||||
|
if(len(remainderList) > self.longestCycle):
|
||||||
|
self.longestCycle = len(remainderList)
|
||||||
|
self.longestNumber = denominator
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Print the results
|
||||||
|
self.result = "The longest cycle is " + str(self.longestCycle) + " digits long" + "\nIt is started with the number " + str(self.longestNumber)
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.longestCycle = 0
|
||||||
|
self.longestNumber = 0
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the length of the longest cycle
|
||||||
|
def getLongestCycle(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the length of the longest cycle")
|
||||||
|
return self.longestCycle
|
||||||
|
#Returns the denominator that starts the longest cycle
|
||||||
|
def getLongestNumber(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the denominaotr that started the cycle")
|
||||||
|
return self.longestNumber
|
||||||
|
|
||||||
|
|
||||||
|
#This calls the appropriate functions if the script is called stand along
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem26()
|
||||||
|
print(problem.getDescription()) #Print the description
|
||||||
|
problem.solve() #Call the function that answers the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
""" Results:
|
||||||
|
The longest cycle is 982 digits long
|
||||||
|
It is started with the number 983
|
||||||
|
It took 182.704 milliseconds to run this algorithm
|
||||||
|
"""
|
||||||
124
Problems/Problem27.py
Normal file
124
Problems/Problem27.py
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
#ProjectEuler/Python/Problem27.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 09-15-19
|
||||||
|
#Modified: 07-19-20
|
||||||
|
#Find the product of the coefficients, |a| < 1000 and |b| <= 1000, for the quadratic expression that produces the maximum number of primes for consecutive values of n, starting with n=0.
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
import Algorithms
|
||||||
|
|
||||||
|
|
||||||
|
class Problem27(Problem):
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("Find the product of the coefficients, |a| < 1000 and |b| <= 1000, for the quadratic expression that produces the maximum number of primes for consecutive values of n, starting with n=0")
|
||||||
|
self.topA = 0 #The A for the most n's generated
|
||||||
|
self.topB = 0 #The B for the most n's generated
|
||||||
|
self.topN = 0 #The most n's generated
|
||||||
|
self.primes = [] #A list of all primes that could possibly be generated with this formula
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Get the primes
|
||||||
|
primes = Algorithms.getPrimes(12000) #A list of all primes that could possibly be generated with this formula
|
||||||
|
#Start with the lowest possible A and check all possibilities after that
|
||||||
|
for a in range(-999, 999):
|
||||||
|
#Start with the lowest possible B and check all possibilities after that
|
||||||
|
for b in range(-1000, 1000):
|
||||||
|
#Start with n=0 and check the formula to see how many primes you can get get with concecutive n's
|
||||||
|
n = 0
|
||||||
|
quadratic = (n * n) + (a * n) + b
|
||||||
|
while(quadratic in primes):
|
||||||
|
n += 1
|
||||||
|
quadratic = (n * n) + (a * n) + b
|
||||||
|
n -= 1 #Negate an n because the last formula failed
|
||||||
|
|
||||||
|
#Set all the largest numbers if this created more primes than any other
|
||||||
|
if(n > self.topN):
|
||||||
|
self.topN = n
|
||||||
|
self.topB = b
|
||||||
|
self.topA = a
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The greatest number of primes found is " + str(self.topN)
|
||||||
|
self.result += "\nIt was found with A = " + str(self.topA) + ", B = " + str(self.topB)
|
||||||
|
self.result += "\nThe product of A and B is " + str(self.topA * self.topB)
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.topA = 0
|
||||||
|
self.topB = 0
|
||||||
|
self.topB = 0
|
||||||
|
self.primes.clear()
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the top A that was generated
|
||||||
|
def getTopA(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the top A")
|
||||||
|
return self.topA
|
||||||
|
#Returns the top B that was generated
|
||||||
|
def getTopB(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the top B")
|
||||||
|
return self.topA
|
||||||
|
#Returns the top N that was generated
|
||||||
|
def getTopN(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the top N")
|
||||||
|
return self.topA
|
||||||
|
|
||||||
|
|
||||||
|
#This calls the appropriate functions if the script is called stand alone
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem27()
|
||||||
|
print(problem.getDescription()) #Print the description
|
||||||
|
problem.solve() #Call the function that answers the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
""" Results:
|
||||||
|
The greatest number of primes found is 70
|
||||||
|
It was found with A = -61, B = 971
|
||||||
|
The product of A and B is -59231
|
||||||
|
It took 35.775 seconds to run this algorithm
|
||||||
|
"""
|
||||||
152
Problems/Problem28.py
Normal file
152
Problems/Problem28.py
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
#ProjectEuler/Python/Problem28.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 09-22-19
|
||||||
|
#Modified: 07-19-20
|
||||||
|
#What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed by starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
|
class Problem28(Problem):
|
||||||
|
#Variables
|
||||||
|
grid = []
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed by starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral")
|
||||||
|
self.sumOfDiagonals = 0
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Setup the grid
|
||||||
|
self.grid = self.setupGrid()
|
||||||
|
#Find the sum of the diagonals in the grid
|
||||||
|
self.sumOfDiagonals = self.findSum()
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The sum of the diagonals in the given grid is " + str(self.sumOfDiagonals)
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Sets up the grid
|
||||||
|
def setupGrid(self) -> list:
|
||||||
|
#Setup the grid to be the right size and fill it with 0's
|
||||||
|
self.grid = [[0 for x in range(1001)] for y in range(1001)]
|
||||||
|
|
||||||
|
finalLocation = False #A flag to indicate if the final location to be filled has been reached
|
||||||
|
currentNum = 1 #Set the number that is going to be put at each location
|
||||||
|
#Start with the middle location and set it correctly and advance the tracker to the next number
|
||||||
|
xLocation = 500
|
||||||
|
yLocation = 500
|
||||||
|
self.grid[yLocation][xLocation] = currentNum
|
||||||
|
currentNum += 1
|
||||||
|
#Move right the first time
|
||||||
|
xLocation += 1
|
||||||
|
#Move in a circular pattern until you reach the final location
|
||||||
|
while(not finalLocation):
|
||||||
|
#Move down until you reach a blank location on the left
|
||||||
|
while(self.grid[yLocation][xLocation - 1] != 0):
|
||||||
|
self.grid[yLocation][xLocation] = currentNum
|
||||||
|
currentNum += 1
|
||||||
|
yLocation += 1
|
||||||
|
|
||||||
|
#Move left until you reach a blank location above
|
||||||
|
while(self.grid[yLocation - 1][xLocation] != 0):
|
||||||
|
self.grid[yLocation][xLocation] = currentNum
|
||||||
|
currentNum += 1
|
||||||
|
xLocation -= 1
|
||||||
|
|
||||||
|
#Move up until you reach a blank location to the right
|
||||||
|
while(self.grid[yLocation][xLocation + 1] != 0):
|
||||||
|
self.grid[yLocation][xLocation] = currentNum
|
||||||
|
currentNum += 1
|
||||||
|
yLocation -= 1
|
||||||
|
|
||||||
|
#Move right until you reach a blank location below
|
||||||
|
while(self.grid[yLocation + 1][xLocation] != 0):
|
||||||
|
self.grid[yLocation][xLocation] = currentNum
|
||||||
|
currentNum += 1
|
||||||
|
xLocation += 1
|
||||||
|
#Check if you are at the final location and break the loop if you are
|
||||||
|
if(xLocation == len(self.grid)):
|
||||||
|
finalLocation = True
|
||||||
|
break
|
||||||
|
return self.grid
|
||||||
|
#Finds the sum of the diagonals in the grid
|
||||||
|
def findSum(self) -> int:
|
||||||
|
sumOfDiagonals = 0
|
||||||
|
leftSide = 0
|
||||||
|
rightSide = len(self.grid) - 1
|
||||||
|
row = 0
|
||||||
|
while(row < len(self.grid)):
|
||||||
|
#This ensure the middle location is only counted once
|
||||||
|
if(leftSide == rightSide):
|
||||||
|
sumOfDiagonals += self.grid[row][leftSide]
|
||||||
|
else:
|
||||||
|
sumOfDiagonals += self.grid[row][leftSide]
|
||||||
|
sumOfDiagonals += self.grid[row][rightSide]
|
||||||
|
row += 1
|
||||||
|
leftSide += 1
|
||||||
|
rightSide -= 1
|
||||||
|
return sumOfDiagonals
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.sumOfDiagonals = 0
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the grid
|
||||||
|
def getGrid(self) -> list:
|
||||||
|
return self.grid
|
||||||
|
#Returns the sum of the diagonals
|
||||||
|
def getSum(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the sum")
|
||||||
|
return self.sumOfDiagonals
|
||||||
|
|
||||||
|
|
||||||
|
#This calls the appropriate functions if the script is called stand alone
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem28()
|
||||||
|
print(problem.getDescription()) #Print the description
|
||||||
|
problem.solve() #Call the function that answers the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
""" Results:
|
||||||
|
The sum of the diagonals in the given grid is 669171001
|
||||||
|
It took 197.764 milliseconds to run this algorithm
|
||||||
|
"""
|
||||||
121
Problems/Problem29.py
Normal file
121
Problems/Problem29.py
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
#ProjectEuler/Python/Problem29.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 10-10-19
|
||||||
|
#Modified: 07-19-20
|
||||||
|
#How many distinct terms are in the sequence generated by a^b for 2 <= a <= 100 and 2 <= b <= 100?
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
|
class Problem29(Problem):
|
||||||
|
#Variables
|
||||||
|
__bottomA = 2 #The lowest possible value for A
|
||||||
|
__topA = 100 #The highest possible value for A
|
||||||
|
__bottomB = 2 #The lowest possible value for B
|
||||||
|
__topB = 100 #The highest possible value for B
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("How many distinct terms are in the sequence generated by a^b for 2 <= a <= 100 and 2 <= b <= 100?")
|
||||||
|
self.unique = []
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Start with the first A and move towards the top
|
||||||
|
for currentA in range(self.__bottomA, self.__topA + 1):
|
||||||
|
#Start with the first B and move towards the top
|
||||||
|
for currentB in range(self.__bottomB, self.__topB + 1):
|
||||||
|
#Get the new number
|
||||||
|
currentNum = currentA ** currentB
|
||||||
|
#If the new number isn't in the list add it
|
||||||
|
if currentNum not in self.unique:
|
||||||
|
self.unique.append(currentNum)
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Print the results
|
||||||
|
self.result = "The number of unique values generated by a^b for " + str(self.__bottomA) + " <= a < = " + str(self.__topA) + " and " + str(self.__bottomB) + " <= b <= " + str(self.__topB) + " is " + str(len(self.unique))
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.unique.clear()
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the lowest possible value for a
|
||||||
|
def getBottomA(self):
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the lowest possible A")
|
||||||
|
return self.__bottomA
|
||||||
|
#Returns the lowest possible value for a
|
||||||
|
def getTopA(self):
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the highest possible A")
|
||||||
|
return self.__topA
|
||||||
|
#Returns the lowest possible value for a
|
||||||
|
def getBottomB(self):
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the lowest possible B")
|
||||||
|
return self.__bottomB
|
||||||
|
#Returns the lowest possible value for a
|
||||||
|
def getTopB(self):
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the highest possible B")
|
||||||
|
return self.__topB
|
||||||
|
#Returns a list of all unique values for a^b
|
||||||
|
def getUnique(self) -> list:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see list of unique values")
|
||||||
|
return self.unique
|
||||||
|
|
||||||
|
|
||||||
|
#This calls the appropriate functions if the script is called stand alone
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem29()
|
||||||
|
print(problem.getDescription()) #Print the description
|
||||||
|
problem.solve() #Call the function that answers the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
""" Results:
|
||||||
|
The number of unique values generated by a^b for 2 <= a < = 100 and 2 <= b <= 100 is 9183
|
||||||
|
It took 304.630 milliseconds to run this algorithm
|
||||||
|
"""
|
||||||
100
Problems/Problem3.py
Normal file
100
Problems/Problem3.py
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
#ProjectEuler/Python/Problem3.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 01-27-19
|
||||||
|
#Modified: 07-17-20
|
||||||
|
#The largest prime factor of 600851475143
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Algorithms import getFactors
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Problem3(Problem):
|
||||||
|
#Variables
|
||||||
|
__goalNumber = 600851475143
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("What is the largest prime factor of 600851475143?")
|
||||||
|
self.factors = []
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Get the factors of the number
|
||||||
|
self.factors = getFactors(self.__goalNumber)
|
||||||
|
#The last element should be the largest factor
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The largest prime factor of " + str(self.__goalNumber) + " is " + str(self.factors[(len(self.factors) - 1)])
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.factors.clear()
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the list of factors of the number
|
||||||
|
def getFactors(self) -> list:
|
||||||
|
#If the problem hasn't been solved throw an exceptions
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the factors")
|
||||||
|
return self.factors
|
||||||
|
#Returns the largest factor of the number
|
||||||
|
def getLargestFactor(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exceptions
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the largest factor")
|
||||||
|
return self.factors[(len(self.factors) - 1)]
|
||||||
|
#Returns the number for which we are getting the factor
|
||||||
|
def getGoalNumber(self) -> int:
|
||||||
|
return self.__goalNumber
|
||||||
|
|
||||||
|
|
||||||
|
#If you are running this file, automatically start the correct function
|
||||||
|
if __name__ == '__main__':
|
||||||
|
problem = Problem3()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
"""Results:
|
||||||
|
The largest prime factor of 600851475143 is 6857
|
||||||
|
It took 1.685 seconds to run this algorithm
|
||||||
|
"""
|
||||||
120
Problems/Problem30.py
Normal file
120
Problems/Problem30.py
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
#ProjectEuler/Python/Problem30.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 10-28-19
|
||||||
|
#Modified: 07-19-20
|
||||||
|
#Find the sum of all the numbers that can be written as the sum of the fifth powers of their digits.
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
|
class Problem30(Problem):
|
||||||
|
#Setup the variables
|
||||||
|
__topNum = 1000000 #This is the largest number that will be checked
|
||||||
|
__bottomNum = 2 #Starts with 2 because 0 and 1 don't count
|
||||||
|
__powerRaised = 5 #This is the power that the digits are raised to
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("Find the sum of all the numbers that can be written as the sum of the fifth powers of their digits.")
|
||||||
|
self.sumOfFifthNumbers = [] #This is an ArrayList of the numbers that are the sum of the fifth power of their digits
|
||||||
|
|
||||||
|
#Operational function
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Start with the lowest number and increment until you reach the largest number
|
||||||
|
for currentNum in range(self.__bottomNum, self.__topNum):
|
||||||
|
#Get the digits of the number
|
||||||
|
digits = self.getDigits(currentNum)
|
||||||
|
#Get the sum of the powers
|
||||||
|
sumOfPowers = 0
|
||||||
|
for cnt in range(0, len(digits)):
|
||||||
|
sumOfPowers += digits[cnt]**self.__powerRaised
|
||||||
|
#Check if the sum of the powers is the same as the number
|
||||||
|
#If it is add it to the list, otherwise continue to the next number
|
||||||
|
if(sumOfPowers == currentNum):
|
||||||
|
self.sumOfFifthNumbers.append(currentNum)
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The sum of all the numbers that can be written as the sum of the fifth powers of their digits is " + str(sum(self.sumOfFifthNumbers))
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Returns a list with the individual digits of the number passed to it
|
||||||
|
def getDigits(self, num: int) -> list:
|
||||||
|
listOfDigits = [] #This list holds the individual digits of num
|
||||||
|
#The easiest way to get the individual digits of a number is by converting it to a string
|
||||||
|
digits = str(num)
|
||||||
|
#Start with the first digit, convert it to an integer, store it in the list, and move to the next digit
|
||||||
|
for cnt in range(0, len(digits)):
|
||||||
|
listOfDigits.append(int(digits[cnt]))
|
||||||
|
#Return the list of digits
|
||||||
|
return listOfDigits
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.sumOfFifthNumbers.clear()
|
||||||
|
#Gets
|
||||||
|
#Returns the top number to be checked
|
||||||
|
def getTopNum(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the top number")
|
||||||
|
return self.__topNum
|
||||||
|
#Returns a copy of the vector holding all the number that are the sum of the fifth powers of their digits
|
||||||
|
def getListOfSumsOfFifths(self) -> list:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the list")
|
||||||
|
return self.sumOfFifthNumbers
|
||||||
|
#Returns the sum of all entries in sumOfFifthNumbers
|
||||||
|
def getSumOfList(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the sum of the list")
|
||||||
|
return sum(self.sumOfFifthNumbers)
|
||||||
|
|
||||||
|
|
||||||
|
#This calls the appropriate functions if the script is called stand alone
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem30()
|
||||||
|
print(problem.getDescription()) #Print the description
|
||||||
|
problem.solve() #Call the function that answers the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
""" Results:
|
||||||
|
The sum of all the numbers that can be written as the sum of the fifth powers of their digits is 443839
|
||||||
|
It took 3.284 seconds to run this algorithm
|
||||||
|
"""
|
||||||
95
Problems/Problem31.py
Normal file
95
Problems/Problem31.py
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
#ProjectEuler/Python/Problem31.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 06-19-20
|
||||||
|
#Modified: 07-19-20
|
||||||
|
#How many different ways can £2 be made using any number of coins?
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
|
class Problem31(Problem):
|
||||||
|
#Variables
|
||||||
|
__desiredValue = 200 #The value of coins we want
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("How many different ways can 2 pounds be made using any number of coins?")
|
||||||
|
self.permutations = 0
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Start with 200p and remove the necessary coins with each loop
|
||||||
|
for pound2 in range(self.__desiredValue, -1, -200):
|
||||||
|
for pound1 in range(pound2, -1, -100):
|
||||||
|
for pence50 in range(pound1, -1, -50):
|
||||||
|
for pence20 in range(pence50, -1, -20):
|
||||||
|
for pence10 in range(pence20, -1, -10):
|
||||||
|
for pence5 in range(pence10, -1, -5):
|
||||||
|
for pence2 in range(pence5, -1, -2):
|
||||||
|
self.permutations += 1
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "There are " + str(self.permutations) + " ways to make 2 pounds with the given denominations of coins"
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.permutations = 0
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the number of correct permutations of the coins
|
||||||
|
def getPermutations(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before can you see the number of permutations")
|
||||||
|
return self.permutations
|
||||||
|
|
||||||
|
|
||||||
|
#This calls the appropriate functions if the script is called stand alone
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem31()
|
||||||
|
print(problem.getDescription()) #Print the description
|
||||||
|
problem.solve() #Call the function that answers the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
|
||||||
|
""" Results:
|
||||||
|
There are 73682 ways to make 2 pounds with the given denominations of coins
|
||||||
|
It took 2.653 milliseconds to run this algorithm
|
||||||
|
"""
|
||||||
103
Problems/Problem4.py
Normal file
103
Problems/Problem4.py
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
#ProjectEuler/Python/Problem4.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 01-28-19
|
||||||
|
#Modified: 07-17-20
|
||||||
|
#Find the largest palindrome made from the product of two 3-digit numbers
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
|
class Problem4(Problem):
|
||||||
|
#Variables
|
||||||
|
__lowestNum = 100
|
||||||
|
__highestNum = 1000
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("Find the largest palindrome made from the product of two 3-digit numbers")
|
||||||
|
self.palindromes = [] #Holds all of the palindromes
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Loop through every number from __lowestNum to __highestNum twice and multiply every number together
|
||||||
|
for firstNum in range(self.__lowestNum, self.__highestNum + 1):
|
||||||
|
for secondNum in range(firstNum, self.__highestNum + 1): #You can start at num1 because 100 * 101 == 101 * 100
|
||||||
|
#Get the product
|
||||||
|
currentNum = firstNum * secondNum
|
||||||
|
#If the number is a palindrome add it to the list of palindromes, otherwise ignore it
|
||||||
|
#Using strings makes it easier to determine a palindrome
|
||||||
|
if(str(currentNum) == str(currentNum)[::-1]):
|
||||||
|
self.palindromes.append(currentNum)
|
||||||
|
#If it's not a palindrom ignore it
|
||||||
|
|
||||||
|
#Sort the palindromes so that the last element is the largest
|
||||||
|
self.palindromes.sort()
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The largest palindrome made from the product of two 3-digit numbers is " + str(self.palindromes[len(self.palindromes) - 1])
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.palindromes.clear()
|
||||||
|
#Gets
|
||||||
|
#Returns the list of all palindromes
|
||||||
|
def getPalindromes(self) -> list:
|
||||||
|
#If the problem hasn't been solved throw an exceptions
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the list of palindromes")
|
||||||
|
return self.palindromes
|
||||||
|
#Returns the largest palindrome
|
||||||
|
def getLargestPalindrome(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exceptions
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the largest palindrome")
|
||||||
|
return self.palindromes[len(self.palindromes) - 1]
|
||||||
|
|
||||||
|
#If you are running this file, automatically start the correct function
|
||||||
|
if __name__ == '__main__':
|
||||||
|
problem = Problem4()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
"""Results:
|
||||||
|
The largest palindrome made from the product of two 3-digit numbers is 906609
|
||||||
|
It took 177.314 milliseconds to run this algorithm
|
||||||
|
"""
|
||||||
107
Problems/Problem5.py
Normal file
107
Problems/Problem5.py
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
#ProjectEulter/Python/Project5.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 01-28-19
|
||||||
|
#Modified: 07-17-20
|
||||||
|
#What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: it can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at itr option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
it should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
|
class Problem5(Problem):
|
||||||
|
#Variables
|
||||||
|
__startNum = 1
|
||||||
|
__stopNum = 20
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?")
|
||||||
|
self.smallestNum = 0
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Start at 20 and loop through all numbers until it find one that works
|
||||||
|
#It must be at least 20 to be divisible by 20
|
||||||
|
numFound = False #A flag for finding the divisible number
|
||||||
|
currentNum = 20 #The number that it are currently checking against
|
||||||
|
while((currentNum > 0) and (not numFound)):
|
||||||
|
#Set that it found the number to true, because it sets this flag when it doesn't find it
|
||||||
|
numFound = True
|
||||||
|
#See if the current number is divisible by all numbers from 1 to 20
|
||||||
|
for divisor in range(self.__startNum, self.__stopNum + 1):
|
||||||
|
#If it is not set a flag to move to the next possible number
|
||||||
|
if((currentNum % divisor) != 0):
|
||||||
|
numFound = False
|
||||||
|
break
|
||||||
|
|
||||||
|
#Increment the number by 2 to check the next one if it didn't find the number
|
||||||
|
if(not numFound):
|
||||||
|
currentNum += 2
|
||||||
|
|
||||||
|
self.smallestNum = currentNum
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
if(currentNum < 0):
|
||||||
|
self.result = "There was an error: Could not find a number that fit the criteria"
|
||||||
|
else:
|
||||||
|
self.result = "The smallest positive number that is evenly divisible by all numbers 1-20 is " + str(self.smallestNum)
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.smallestNum = 0
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the requested number
|
||||||
|
def getNumber(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exceptions
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the requested number")
|
||||||
|
return self.smallestNum
|
||||||
|
|
||||||
|
#If it are running this file, automatically start the correct function
|
||||||
|
if __name__ == '__main__':
|
||||||
|
problem = Problem5()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
"""Results:
|
||||||
|
The smallest positive number that is evenly divisible by all numbers 1-20 is 232792560
|
||||||
|
It took 50.236 seconds to run this algorithm
|
||||||
|
"""
|
||||||
106
Problems/Problem6.py
Normal file
106
Problems/Problem6.py
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
#ProjectEuler/Python/Problem6.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 01-28-19
|
||||||
|
#Modified: 07-18-20
|
||||||
|
#Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
|
class Problem6(Problem):
|
||||||
|
#Variables
|
||||||
|
__startNum = 1
|
||||||
|
__endNum = 100
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.")
|
||||||
|
self.sumOfSquares = 0 #Holds the sum of the squares of all the numbers
|
||||||
|
self.squareOfSum = 0 #Holds the square of the sum of all the numbers
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Run through all numbers from 1-100 and add them to the approriate sums
|
||||||
|
for num in range(1, 101):
|
||||||
|
self.sumOfSquares += (num * num) #Get the sum of the squares of the first 100 natural numbers
|
||||||
|
self.squareOfSum += num #Get the sum of the first 100 natural numbers so you can square it later
|
||||||
|
#Square the normal sum
|
||||||
|
self.squareOfSum *= self.squareOfSum
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the result
|
||||||
|
self.result = "The difference between the sum of the squares and the square of the sum of the numbers 1-100 is " + str(abs(self.sumOfSquares - self.squareOfSum))
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.squareOfSum = 0
|
||||||
|
self.sumOfSquares = 0
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the sum of all the squares
|
||||||
|
def getSumOfSquares(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exceptions
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the sum of squares")
|
||||||
|
return self.sumOfSquares
|
||||||
|
#Return the sqare of all of the sums
|
||||||
|
def getSquareOfSum(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exceptions
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the square of sum")
|
||||||
|
return self.squareOfSum
|
||||||
|
#Returns the requested difference
|
||||||
|
def getDifference(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exceptions
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the difference between the sum of squares and square of sum")
|
||||||
|
return abs(self.sumOfSquares - self.squareOfSum)
|
||||||
|
|
||||||
|
#If you are running this file, automatically start the correct function
|
||||||
|
if __name__ == '__main__':
|
||||||
|
problem = Problem6()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
"""Results:
|
||||||
|
The difference between the sum of the squares and the square of the sum of the numbers 1-100 is 25164150
|
||||||
|
It took 24.384 microseconds to run this algorithm
|
||||||
|
"""
|
||||||
364
Problems/Problem67.py
Normal file
364
Problems/Problem67.py
Normal file
@@ -0,0 +1,364 @@
|
|||||||
|
#ProjectEuler/Python/Problem67.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 03-26-19
|
||||||
|
#Modified: 07-19-20
|
||||||
|
#Find the maximum total from top to bottom
|
||||||
|
"""
|
||||||
|
59
|
||||||
|
73 41
|
||||||
|
52 40 09
|
||||||
|
26 53 06 34
|
||||||
|
10 51 87 86 81
|
||||||
|
61 95 66 57 25 68
|
||||||
|
90 81 80 38 92 67 73
|
||||||
|
30 28 51 76 81 18 75 44
|
||||||
|
84 14 95 87 62 81 17 78 58
|
||||||
|
21 46 71 58 02 79 62 39 31 09
|
||||||
|
56 34 35 53 78 31 81 18 90 93 15
|
||||||
|
78 53 04 21 84 93 32 13 97 11 37 51
|
||||||
|
45 03 81 79 05 18 78 86 13 30 63 99 95
|
||||||
|
39 87 96 28 03 38 42 17 82 87 58 07 22 57
|
||||||
|
06 17 51 17 07 93 09 07 75 97 95 78 87 08 53
|
||||||
|
67 66 59 60 88 99 94 65 55 77 55 34 27 53 78 28
|
||||||
|
76 40 41 04 87 16 09 42 75 69 23 97 30 60 10 79 87
|
||||||
|
12 10 44 26 21 36 32 84 98 60 13 12 36 16 63 31 91 35
|
||||||
|
70 39 06 05 55 27 38 48 28 22 34 35 62 62 15 14 94 89 86
|
||||||
|
66 56 68 84 96 21 34 34 34 81 62 40 65 54 62 05 98 03 02 60
|
||||||
|
38 89 46 37 99 54 34 53 36 14 70 26 02 90 45 13 31 61 83 73 47
|
||||||
|
36 10 63 96 60 49 41 05 37 42 14 58 84 93 96 17 09 43 05 43 06 59
|
||||||
|
66 57 87 57 61 28 37 51 84 73 79 15 39 95 88 87 43 39 11 86 77 74 18
|
||||||
|
54 42 05 79 30 49 99 73 46 37 50 02 45 09 54 52 27 95 27 65 19 45 26 45
|
||||||
|
71 39 17 78 76 29 52 90 18 99 78 19 35 62 71 19 23 65 93 85 49 33 75 09 02
|
||||||
|
33 24 47 61 60 55 32 88 57 55 91 54 46 57 07 77 98 52 80 99 24 25 46 78 79 05
|
||||||
|
92 09 13 55 10 67 26 78 76 82 63 49 51 31 24 68 05 57 07 54 69 21 67 43 17 63 12
|
||||||
|
24 59 06 08 98 74 66 26 61 60 13 03 09 09 24 30 71 08 88 70 72 70 29 90 11 82 41 34
|
||||||
|
66 82 67 04 36 60 92 77 91 85 62 49 59 61 30 90 29 94 26 41 89 04 53 22 83 41 09 74 90
|
||||||
|
48 28 26 37 28 52 77 26 51 32 18 98 79 36 62 13 17 08 19 54 89 29 73 68 42 14 08 16 70 37
|
||||||
|
37 60 69 70 72 71 09 59 13 60 38 13 57 36 09 30 43 89 30 39 15 02 44 73 05 73 26 63 56 86 12
|
||||||
|
55 55 85 50 62 99 84 77 28 85 03 21 27 22 19 26 82 69 54 04 13 07 85 14 01 15 70 59 89 95 10 19
|
||||||
|
04 09 31 92 91 38 92 86 98 75 21 05 64 42 62 84 36 20 73 42 21 23 22 51 51 79 25 45 85 53 03 43 22
|
||||||
|
75 63 02 49 14 12 89 14 60 78 92 16 44 82 38 30 72 11 46 52 90 27 08 65 78 03 85 41 57 79 39 52 33 48
|
||||||
|
78 27 56 56 39 13 19 43 86 72 58 95 39 07 04 34 21 98 39 15 39 84 89 69 84 46 37 57 59 35 59 50 26 15 93
|
||||||
|
42 89 36 27 78 91 24 11 17 41 05 94 07 69 51 96 03 96 47 90 90 45 91 20 50 56 10 32 36 49 04 53 85 92 25 65
|
||||||
|
52 09 61 30 61 97 66 21 96 92 98 90 06 34 96 60 32 69 68 33 75 84 18 31 71 50 84 63 03 03 19 11 28 42 75 45 45
|
||||||
|
61 31 61 68 96 34 49 39 05 71 76 59 62 67 06 47 96 99 34 21 32 47 52 07 71 60 42 72 94 56 82 83 84 40 94 87 82 46
|
||||||
|
01 20 60 14 17 38 26 78 66 81 45 95 18 51 98 81 48 16 53 88 37 52 69 95 72 93 22 34 98 20 54 27 73 61 56 63 60 34 63
|
||||||
|
93 42 94 83 47 61 27 51 79 79 45 01 44 73 31 70 83 42 88 25 53 51 30 15 65 94 80 44 61 84 12 77 02 62 02 65 94 42 14 94
|
||||||
|
32 73 09 67 68 29 74 98 10 19 85 48 38 31 85 67 53 93 93 77 47 67 39 72 94 53 18 43 77 40 78 32 29 59 24 06 02 83 50 60 66
|
||||||
|
32 01 44 30 16 51 15 81 98 15 10 62 86 79 50 62 45 60 70 38 31 85 65 61 64 06 69 84 14 22 56 43 09 48 66 69 83 91 60 40 36 61
|
||||||
|
92 48 22 99 15 95 64 43 01 16 94 02 99 19 17 69 11 58 97 56 89 31 77 45 67 96 12 73 08 20 36 47 81 44 50 64 68 85 40 81 85 52 09
|
||||||
|
91 35 92 45 32 84 62 15 19 64 21 66 06 01 52 80 62 59 12 25 88 28 91 50 40 16 22 99 92 79 87 51 21 77 74 77 07 42 38 42 74 83 02 05
|
||||||
|
46 19 77 66 24 18 05 32 02 84 31 99 92 58 96 72 91 36 62 99 55 29 53 42 12 37 26 58 89 50 66 19 82 75 12 48 24 87 91 85 02 07 03 76 86
|
||||||
|
99 98 84 93 07 17 33 61 92 20 66 60 24 66 40 30 67 05 37 29 24 96 03 27 70 62 13 04 45 47 59 88 43 20 66 15 46 92 30 04 71 66 78 70 53 99
|
||||||
|
67 60 38 06 88 04 17 72 10 99 71 07 42 25 54 05 26 64 91 50 45 71 06 30 67 48 69 82 08 56 80 67 18 46 66 63 01 20 08 80 47 07 91 16 03 79 87
|
||||||
|
18 54 78 49 80 48 77 40 68 23 60 88 58 80 33 57 11 69 55 53 64 02 94 49 60 92 16 35 81 21 82 96 25 24 96 18 02 05 49 03 50 77 06 32 84 27 18 38
|
||||||
|
68 01 50 04 03 21 42 94 53 24 89 05 92 26 52 36 68 11 85 01 04 42 02 45 15 06 50 04 53 73 25 74 81 88 98 21 67 84 79 97 99 20 95 04 40 46 02 58 87
|
||||||
|
94 10 02 78 88 52 21 03 88 60 06 53 49 71 20 91 12 65 07 49 21 22 11 41 58 99 36 16 09 48 17 24 52 36 23 15 72 16 84 56 02 99 43 76 81 71 29 39 49 17
|
||||||
|
64 39 59 84 86 16 17 66 03 09 43 06 64 18 63 29 68 06 23 07 87 14 26 35 17 12 98 41 53 64 78 18 98 27 28 84 80 67 75 62 10 11 76 90 54 10 05 54 41 39 66
|
||||||
|
43 83 18 37 32 31 52 29 95 47 08 76 35 11 04 53 35 43 34 10 52 57 12 36 20 39 40 55 78 44 07 31 38 26 08 15 56 88 86 01 52 62 10 24 32 05 60 65 53 28 57 99
|
||||||
|
03 50 03 52 07 73 49 92 66 80 01 46 08 67 25 36 73 93 07 42 25 53 13 96 76 83 87 90 54 89 78 22 78 91 73 51 69 09 79 94 83 53 09 40 69 62 10 79 49 47 03 81 30
|
||||||
|
71 54 73 33 51 76 59 54 79 37 56 45 84 17 62 21 98 69 41 95 65 24 39 37 62 03 24 48 54 64 46 82 71 78 33 67 09 16 96 68 52 74 79 68 32 21 13 78 96 60 09 69 20 36
|
||||||
|
73 26 21 44 46 38 17 83 65 98 07 23 52 46 61 97 33 13 60 31 70 15 36 77 31 58 56 93 75 68 21 36 69 53 90 75 25 82 39 50 65 94 29 30 11 33 11 13 96 02 56 47 07 49 02
|
||||||
|
76 46 73 30 10 20 60 70 14 56 34 26 37 39 48 24 55 76 84 91 39 86 95 61 50 14 53 93 64 67 37 31 10 84 42 70 48 20 10 72 60 61 84 79 69 65 99 73 89 25 85 48 92 56 97 16
|
||||||
|
03 14 80 27 22 30 44 27 67 75 79 32 51 54 81 29 65 14 19 04 13 82 04 91 43 40 12 52 29 99 07 76 60 25 01 07 61 71 37 92 40 47 99 66 57 01 43 44 22 40 53 53 09 69 26 81 07
|
||||||
|
49 80 56 90 93 87 47 13 75 28 87 23 72 79 32 18 27 20 28 10 37 59 21 18 70 04 79 96 03 31 45 71 81 06 14 18 17 05 31 50 92 79 23 47 09 39 47 91 43 54 69 47 42 95 62 46 32 85
|
||||||
|
37 18 62 85 87 28 64 05 77 51 47 26 30 65 05 70 65 75 59 80 42 52 25 20 44 10 92 17 71 95 52 14 77 13 24 55 11 65 26 91 01 30 63 15 49 48 41 17 67 47 03 68 20 90 98 32 04 40 68
|
||||||
|
90 51 58 60 06 55 23 68 05 19 76 94 82 36 96 43 38 90 87 28 33 83 05 17 70 83 96 93 06 04 78 47 80 06 23 84 75 23 87 72 99 14 50 98 92 38 90 64 61 58 76 94 36 66 87 80 51 35 61 38
|
||||||
|
57 95 64 06 53 36 82 51 40 33 47 14 07 98 78 65 39 58 53 06 50 53 04 69 40 68 36 69 75 78 75 60 03 32 39 24 74 47 26 90 13 40 44 71 90 76 51 24 36 50 25 45 70 80 61 80 61 43 90 64 11
|
||||||
|
18 29 86 56 68 42 79 10 42 44 30 12 96 18 23 18 52 59 02 99 67 46 60 86 43 38 55 17 44 93 42 21 55 14 47 34 55 16 49 24 23 29 96 51 55 10 46 53 27 92 27 46 63 57 30 65 43 27 21 20 24 83
|
||||||
|
81 72 93 19 69 52 48 01 13 83 92 69 20 48 69 59 20 62 05 42 28 89 90 99 32 72 84 17 08 87 36 03 60 31 36 36 81 26 97 36 48 54 56 56 27 16 91 08 23 11 87 99 33 47 02 14 44 73 70 99 43 35 33
|
||||||
|
90 56 61 86 56 12 70 59 63 32 01 15 81 47 71 76 95 32 65 80 54 70 34 51 40 45 33 04 64 55 78 68 88 47 31 47 68 87 03 84 23 44 89 72 35 08 31 76 63 26 90 85 96 67 65 91 19 14 17 86 04 71 32 95
|
||||||
|
37 13 04 22 64 37 37 28 56 62 86 33 07 37 10 44 52 82 52 06 19 52 57 75 90 26 91 24 06 21 14 67 76 30 46 14 35 89 89 41 03 64 56 97 87 63 22 34 03 79 17 45 11 53 25 56 96 61 23 18 63 31 37 37 47
|
||||||
|
77 23 26 70 72 76 77 04 28 64 71 69 14 85 96 54 95 48 06 62 99 83 86 77 97 75 71 66 30 19 57 90 33 01 60 61 14 12 90 99 32 77 56 41 18 14 87 49 10 14 90 64 18 50 21 74 14 16 88 05 45 73 82 47 74 44
|
||||||
|
22 97 41 13 34 31 54 61 56 94 03 24 59 27 98 77 04 09 37 40 12 26 87 09 71 70 07 18 64 57 80 21 12 71 83 94 60 39 73 79 73 19 97 32 64 29 41 07 48 84 85 67 12 74 95 20 24 52 41 67 56 61 29 93 35 72 69
|
||||||
|
72 23 63 66 01 11 07 30 52 56 95 16 65 26 83 90 50 74 60 18 16 48 43 77 37 11 99 98 30 94 91 26 62 73 45 12 87 73 47 27 01 88 66 99 21 41 95 80 02 53 23 32 61 48 32 43 43 83 14 66 95 91 19 81 80 67 25 88
|
||||||
|
08 62 32 18 92 14 83 71 37 96 11 83 39 99 05 16 23 27 10 67 02 25 44 11 55 31 46 64 41 56 44 74 26 81 51 31 45 85 87 09 81 95 22 28 76 69 46 48 64 87 67 76 27 89 31 11 74 16 62 03 60 94 42 47 09 34 94 93 72
|
||||||
|
56 18 90 18 42 17 42 32 14 86 06 53 33 95 99 35 29 15 44 20 49 59 25 54 34 59 84 21 23 54 35 90 78 16 93 13 37 88 54 19 86 67 68 55 66 84 65 42 98 37 87 56 33 28 58 38 28 38 66 27 52 21 81 15 08 22 97 32 85 27
|
||||||
|
91 53 40 28 13 34 91 25 01 63 50 37 22 49 71 58 32 28 30 18 68 94 23 83 63 62 94 76 80 41 90 22 82 52 29 12 18 56 10 08 35 14 37 57 23 65 67 40 72 39 93 39 70 89 40 34 07 46 94 22 20 05 53 64 56 30 05 56 61 88 27
|
||||||
|
23 95 11 12 37 69 68 24 66 10 87 70 43 50 75 07 62 41 83 58 95 93 89 79 45 39 02 22 05 22 95 43 62 11 68 29 17 40 26 44 25 71 87 16 70 85 19 25 59 94 90 41 41 80 61 70 55 60 84 33 95 76 42 63 15 09 03 40 38 12 03 32
|
||||||
|
09 84 56 80 61 55 85 97 16 94 82 94 98 57 84 30 84 48 93 90 71 05 95 90 73 17 30 98 40 64 65 89 07 79 09 19 56 36 42 30 23 69 73 72 07 05 27 61 24 31 43 48 71 84 21 28 26 65 65 59 65 74 77 20 10 81 61 84 95 08 52 23 70
|
||||||
|
47 81 28 09 98 51 67 64 35 51 59 36 92 82 77 65 80 24 72 53 22 07 27 10 21 28 30 22 48 82 80 48 56 20 14 43 18 25 50 95 90 31 77 08 09 48 44 80 90 22 93 45 82 17 13 96 25 26 08 73 34 99 06 49 24 06 83 51 40 14 15 10 25 01
|
||||||
|
54 25 10 81 30 64 24 74 75 80 36 75 82 60 22 69 72 91 45 67 03 62 79 54 89 74 44 83 64 96 66 73 44 30 74 50 37 05 09 97 70 01 60 46 37 91 39 75 75 18 58 52 72 78 51 81 86 52 08 97 01 46 43 66 98 62 81 18 70 93 73 08 32 46 34
|
||||||
|
96 80 82 07 59 71 92 53 19 20 88 66 03 26 26 10 24 27 50 82 94 73 63 08 51 33 22 45 19 13 58 33 90 15 22 50 36 13 55 06 35 47 82 52 33 61 36 27 28 46 98 14 73 20 73 32 16 26 80 53 47 66 76 38 94 45 02 01 22 52 47 96 64 58 52 39
|
||||||
|
88 46 23 39 74 63 81 64 20 90 33 33 76 55 58 26 10 46 42 26 74 74 12 83 32 43 09 02 73 55 86 54 85 34 28 23 29 79 91 62 47 41 82 87 99 22 48 90 20 05 96 75 95 04 43 28 81 39 81 01 28 42 78 25 39 77 90 57 58 98 17 36 73 22 63 74 51
|
||||||
|
29 39 74 94 95 78 64 24 38 86 63 87 93 06 70 92 22 16 80 64 29 52 20 27 23 50 14 13 87 15 72 96 81 22 08 49 72 30 70 24 79 31 16 64 59 21 89 34 96 91 48 76 43 53 88 01 57 80 23 81 90 79 58 01 80 87 17 99 86 90 72 63 32 69 14 28 88 69
|
||||||
|
37 17 71 95 56 93 71 35 43 45 04 98 92 94 84 96 11 30 31 27 31 60 92 03 48 05 98 91 86 94 35 90 90 08 48 19 33 28 68 37 59 26 65 96 50 68 22 07 09 49 34 31 77 49 43 06 75 17 81 87 61 79 52 26 27 72 29 50 07 98 86 01 17 10 46 64 24 18 56
|
||||||
|
51 30 25 94 88 85 79 91 40 33 63 84 49 67 98 92 15 26 75 19 82 05 18 78 65 93 61 48 91 43 59 41 70 51 22 15 92 81 67 91 46 98 11 11 65 31 66 10 98 65 83 21 05 56 05 98 73 67 46 74 69 34 08 30 05 52 07 98 32 95 30 94 65 50 24 63 28 81 99 57
|
||||||
|
19 23 61 36 09 89 71 98 65 17 30 29 89 26 79 74 94 11 44 48 97 54 81 55 39 66 69 45 28 47 13 86 15 76 74 70 84 32 36 33 79 20 78 14 41 47 89 28 81 05 99 66 81 86 38 26 06 25 13 60 54 55 23 53 27 05 89 25 23 11 13 54 59 54 56 34 16 24 53 44 06
|
||||||
|
13 40 57 72 21 15 60 08 04 19 11 98 34 45 09 97 86 71 03 15 56 19 15 44 97 31 90 04 87 87 76 08 12 30 24 62 84 28 12 85 82 53 99 52 13 94 06 65 97 86 09 50 94 68 69 74 30 67 87 94 63 07 78 27 80 36 69 41 06 92 32 78 37 82 30 05 18 87 99 72 19 99
|
||||||
|
44 20 55 77 69 91 27 31 28 81 80 27 02 07 97 23 95 98 12 25 75 29 47 71 07 47 78 39 41 59 27 76 13 15 66 61 68 35 69 86 16 53 67 63 99 85 41 56 08 28 33 40 94 76 90 85 31 70 24 65 84 65 99 82 19 25 54 37 21 46 33 02 52 99 51 33 26 04 87 02 08 18 96
|
||||||
|
54 42 61 45 91 06 64 79 80 82 32 16 83 63 42 49 19 78 65 97 40 42 14 61 49 34 04 18 25 98 59 30 82 72 26 88 54 36 21 75 03 88 99 53 46 51 55 78 22 94 34 40 68 87 84 25 30 76 25 08 92 84 42 61 40 38 09 99 40 23 29 39 46 55 10 90 35 84 56 70 63 23 91 39
|
||||||
|
52 92 03 71 89 07 09 37 68 66 58 20 44 92 51 56 13 71 79 99 26 37 02 06 16 67 36 52 58 16 79 73 56 60 59 27 44 77 94 82 20 50 98 33 09 87 94 37 40 83 64 83 58 85 17 76 53 02 83 52 22 27 39 20 48 92 45 21 09 42 24 23 12 37 52 28 50 78 79 20 86 62 73 20 59
|
||||||
|
54 96 80 15 91 90 99 70 10 09 58 90 93 50 81 99 54 38 36 10 30 11 35 84 16 45 82 18 11 97 36 43 96 79 97 65 40 48 23 19 17 31 64 52 65 65 37 32 65 76 99 79 34 65 79 27 55 33 03 01 33 27 61 28 66 08 04 70 49 46 48 83 01 45 19 96 13 81 14 21 31 79 93 85 50 05
|
||||||
|
92 92 48 84 59 98 31 53 23 27 15 22 79 95 24 76 05 79 16 93 97 89 38 89 42 83 02 88 94 95 82 21 01 97 48 39 31 78 09 65 50 56 97 61 01 07 65 27 21 23 14 15 80 97 44 78 49 35 33 45 81 74 34 05 31 57 09 38 94 07 69 54 69 32 65 68 46 68 78 90 24 28 49 51 45 86 35
|
||||||
|
41 63 89 76 87 31 86 09 46 14 87 82 22 29 47 16 13 10 70 72 82 95 48 64 58 43 13 75 42 69 21 12 67 13 64 85 58 23 98 09 37 76 05 22 31 12 66 50 29 99 86 72 45 25 10 28 19 06 90 43 29 31 67 79 46 25 74 14 97 35 76 37 65 46 23 82 06 22 30 76 93 66 94 17 96 13 20 72
|
||||||
|
63 40 78 08 52 09 90 41 70 28 36 14 46 44 85 96 24 52 58 15 87 37 05 98 99 39 13 61 76 38 44 99 83 74 90 22 53 80 56 98 30 51 63 39 44 30 91 91 04 22 27 73 17 35 53 18 35 45 54 56 27 78 48 13 69 36 44 38 71 25 30 56 15 22 73 43 32 69 59 25 93 83 45 11 34 94 44 39 92
|
||||||
|
12 36 56 88 13 96 16 12 55 54 11 47 19 78 17 17 68 81 77 51 42 55 99 85 66 27 81 79 93 42 65 61 69 74 14 01 18 56 12 01 58 37 91 22 42 66 83 25 19 04 96 41 25 45 18 69 96 88 36 93 10 12 98 32 44 83 83 04 72 91 04 27 73 07 34 37 71 60 59 31 01 54 54 44 96 93 83 36 04 45
|
||||||
|
30 18 22 20 42 96 65 79 17 41 55 69 94 81 29 80 91 31 85 25 47 26 43 49 02 99 34 67 99 76 16 14 15 93 08 32 99 44 61 77 67 50 43 55 87 55 53 72 17 46 62 25 50 99 73 05 93 48 17 31 70 80 59 09 44 59 45 13 74 66 58 94 87 73 16 14 85 38 74 99 64 23 79 28 71 42 20 37 82 31 23
|
||||||
|
51 96 39 65 46 71 56 13 29 68 53 86 45 33 51 49 12 91 21 21 76 85 02 17 98 15 46 12 60 21 88 30 92 83 44 59 42 50 27 88 46 86 94 73 45 54 23 24 14 10 94 21 20 34 23 51 04 83 99 75 90 63 60 16 22 33 83 70 11 32 10 50 29 30 83 46 11 05 31 17 86 42 49 01 44 63 28 60 07 78 95 40
|
||||||
|
44 61 89 59 04 49 51 27 69 71 46 76 44 04 09 34 56 39 15 06 94 91 75 90 65 27 56 23 74 06 23 33 36 69 14 39 05 34 35 57 33 22 76 46 56 10 61 65 98 09 16 69 04 62 65 18 99 76 49 18 72 66 73 83 82 40 76 31 89 91 27 88 17 35 41 35 32 51 32 67 52 68 74 85 80 57 07 11 62 66 47 22 67
|
||||||
|
65 37 19 97 26 17 16 24 24 17 50 37 64 82 24 36 32 11 68 34 69 31 32 89 79 93 96 68 49 90 14 23 04 04 67 99 81 74 70 74 36 96 68 09 64 39 88 35 54 89 96 58 66 27 88 97 32 14 06 35 78 20 71 06 85 66 57 02 58 91 72 05 29 56 73 48 86 52 09 93 22 57 79 42 12 01 31 68 17 59 63 76 07 77
|
||||||
|
73 81 14 13 17 20 11 09 01 83 08 85 91 70 84 63 62 77 37 07 47 01 59 95 39 69 39 21 99 09 87 02 97 16 92 36 74 71 90 66 33 73 73 75 52 91 11 12 26 53 05 26 26 48 61 50 90 65 01 87 42 47 74 35 22 73 24 26 56 70 52 05 48 41 31 18 83 27 21 39 80 85 26 08 44 02 71 07 63 22 05 52 19 08 20
|
||||||
|
17 25 21 11 72 93 33 49 64 23 53 82 03 13 91 65 85 02 40 05 42 31 77 42 05 36 06 54 04 58 07 76 87 83 25 57 66 12 74 33 85 37 74 32 20 69 03 97 91 68 82 44 19 14 89 28 85 85 80 53 34 87 58 98 88 78 48 65 98 40 11 57 10 67 70 81 60 79 74 72 97 59 79 47 30 20 54 80 89 91 14 05 33 36 79 39
|
||||||
|
60 85 59 39 60 07 57 76 77 92 06 35 15 72 23 41 45 52 95 18 64 79 86 53 56 31 69 11 91 31 84 50 44 82 22 81 41 40 30 42 30 91 48 94 74 76 64 58 74 25 96 57 14 19 03 99 28 83 15 75 99 01 89 85 79 50 03 95 32 67 44 08 07 41 62 64 29 20 14 76 26 55 48 71 69 66 19 72 44 25 14 01 48 74 12 98 07
|
||||||
|
64 66 84 24 18 16 27 48 20 14 47 69 30 86 48 40 23 16 61 21 51 50 26 47 35 33 91 28 78 64 43 68 04 79 51 08 19 60 52 95 06 68 46 86 35 97 27 58 04 65 30 58 99 12 12 75 91 39 50 31 42 64 70 04 46 07 98 73 98 93 37 89 77 91 64 71 64 65 66 21 78 62 81 74 42 20 83 70 73 95 78 45 92 27 34 53 71 15
|
||||||
|
30 11 85 31 34 71 13 48 05 14 44 03 19 67 23 73 19 57 06 90 94 72 57 69 81 62 59 68 88 57 55 69 49 13 07 87 97 80 89 05 71 05 05 26 38 40 16 62 45 99 18 38 98 24 21 26 62 74 69 04 85 57 77 35 58 67 91 79 79 57 86 28 66 34 72 51 76 78 36 95 63 90 08 78 47 63 45 31 22 70 52 48 79 94 15 77 61 67 68
|
||||||
|
23 33 44 81 80 92 93 75 94 88 23 61 39 76 22 03 28 94 32 06 49 65 41 34 18 23 08 47 62 60 03 63 33 13 80 52 31 54 73 43 70 26 16 69 57 87 83 31 03 93 70 81 47 95 77 44 29 68 39 51 56 59 63 07 25 70 07 77 43 53 64 03 94 42 95 39 18 01 66 21 16 97 20 50 90 16 70 10 95 69 29 06 25 61 41 26 15 59 63 35
|
||||||
|
"""
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
from collections import namedtuple
|
||||||
|
|
||||||
|
|
||||||
|
class Problem67(Problem):
|
||||||
|
#Structures
|
||||||
|
location = namedtuple("location", "xLocation yLocation total fromRight")
|
||||||
|
|
||||||
|
#Variables
|
||||||
|
__listNum = [[59],
|
||||||
|
[73, 41],
|
||||||
|
[52, 40, 9],
|
||||||
|
[26, 53, 6, 34],
|
||||||
|
[10, 51, 87, 86, 81],
|
||||||
|
[61, 95, 66, 57, 25, 68],
|
||||||
|
[90, 81, 80, 38, 92, 67, 73],
|
||||||
|
[30, 28, 51, 76, 81, 18, 75, 44],
|
||||||
|
[84, 14, 95, 87, 62, 81, 17, 78, 58],
|
||||||
|
[21, 46, 71, 58, 2, 79, 62, 39, 31, 9],
|
||||||
|
[56, 34, 35, 53, 78, 31, 81, 18, 90, 93, 15],
|
||||||
|
[78, 53, 4, 21, 84, 93, 32, 13, 97, 11, 37, 51],
|
||||||
|
[45, 3, 81, 79, 5, 18, 78, 86, 13, 30, 63, 99, 95],
|
||||||
|
[39, 87, 96, 28, 3, 38, 42, 17, 82, 87, 58, 7, 22, 57],
|
||||||
|
[ 6, 17, 51, 17, 7, 93, 9, 7, 75, 97, 95, 78, 87, 8, 53],
|
||||||
|
[67, 66, 59, 60, 88, 99, 94, 65, 55, 77, 55, 34, 27, 53, 78, 28],
|
||||||
|
[76, 40, 41, 4, 87, 16, 9, 42, 75, 69, 23, 97, 30, 60, 10, 79, 87],
|
||||||
|
[12, 10, 44, 26, 21, 36, 32, 84, 98, 60, 13, 12, 36, 16, 63, 31, 91, 35],
|
||||||
|
[70, 39, 6, 5, 55, 27, 38, 48, 28, 22, 34, 35, 62, 62, 15, 14, 94, 89, 86],
|
||||||
|
[66, 56, 68, 84, 96, 21, 34, 34, 34, 81, 62, 40, 65, 54, 62, 5, 98, 3, 2, 60],
|
||||||
|
[38, 89, 46, 37, 99, 54, 34, 53, 36, 14, 70, 26, 2, 90, 45, 13, 31, 61, 83, 73, 47],
|
||||||
|
[36, 10, 63, 96, 60, 49, 41, 5, 37, 42, 14, 58, 84, 93, 96, 17, 9, 43, 5, 43, 6, 59],
|
||||||
|
[66, 57, 87, 57, 61, 28, 37, 51, 84, 73, 79, 15, 39, 95, 88, 87, 43, 39, 11, 86, 77, 74, 18],
|
||||||
|
[54, 42, 5, 79, 30, 49, 99, 73, 46, 37, 50, 2, 45, 9, 54, 52, 27, 95, 27, 65, 19, 45, 26, 45],
|
||||||
|
[71, 39, 17, 78, 76, 29, 52, 90, 18, 99, 78, 19, 35, 62, 71, 19, 23, 65, 93, 85, 49, 33, 75, 9, 2],
|
||||||
|
[33, 24, 47, 61, 60, 55, 32, 88, 57, 55, 91, 54, 46, 57, 7, 77, 98, 52, 80, 99, 24, 25, 46, 78, 79, 5],
|
||||||
|
[92, 9, 13, 55, 10, 67, 26, 78, 76, 82, 63, 49, 51, 31, 24, 68, 5, 57, 7, 54, 69, 21, 67, 43, 17, 63, 12],
|
||||||
|
[24, 59, 6, 8, 98, 74, 66, 26, 61, 60, 13, 3, 9, 9, 24, 30, 71, 8, 88, 70, 72, 70, 29, 90, 11, 82, 41, 34],
|
||||||
|
[66, 82, 67, 4, 36, 60, 92, 77, 91, 85, 62, 49, 59, 61, 30, 90, 29, 94, 26, 41, 89, 4, 53, 22, 83, 41, 9, 74, 90],
|
||||||
|
[48, 28, 26, 37, 28, 52, 77, 26, 51, 32, 18, 98, 79, 36, 62, 13, 17, 8, 19, 54, 89, 29, 73, 68, 42, 14, 8, 16, 70, 37],
|
||||||
|
[37, 60, 69, 70, 72, 71, 9, 59, 13, 60, 38, 13, 57, 36, 9, 30, 43, 89, 30, 39, 15, 2, 44, 73, 5, 73, 26, 63, 56, 86, 12],
|
||||||
|
[55, 55, 85, 50, 62, 99, 84, 77, 28, 85, 3, 21, 27, 22, 19, 26, 82, 69, 54, 4, 13, 7, 85, 14, 1, 15, 70, 59, 89, 95, 10, 19],
|
||||||
|
[ 4, 9, 31, 92, 91, 38, 92, 86, 98, 75, 21, 5, 64, 42, 62, 84, 36, 20, 73, 42, 21, 23, 22, 51, 51, 79, 25, 45, 85, 53, 3, 43, 22],
|
||||||
|
[75, 63, 2, 49, 14, 12, 89, 14, 60, 78, 92, 16, 44, 82, 38, 30, 72, 11, 46, 52, 90, 27, 8, 65, 78, 3, 85, 41, 57, 79, 39, 52, 33, 48],
|
||||||
|
[78, 27, 56, 56, 39, 13, 19, 43, 86, 72, 58, 95, 39, 7, 4, 34, 21, 98, 39, 15, 39, 84, 89, 69, 84, 46, 37, 57, 59, 35, 59, 50, 26, 15, 93],
|
||||||
|
[42, 89, 36, 27, 78, 91, 24, 11, 17, 41, 5, 94, 7, 69, 51, 96, 3, 96, 47, 90, 90, 45, 91, 20, 50, 56, 10, 32, 36, 49, 4, 53, 85, 92, 25, 65],
|
||||||
|
[52, 9, 61, 30, 61, 97, 66, 21, 96, 92, 98, 90, 6, 34, 96, 60, 32, 69, 68, 33, 75, 84, 18, 31, 71, 50, 84, 63, 3, 3, 19, 11, 28, 42, 75, 45, 45],
|
||||||
|
[61, 31, 61, 68, 96, 34, 49, 39, 5, 71, 76, 59, 62, 67, 6, 47, 96, 99, 34, 21, 32, 47, 52, 7, 71, 60, 42, 72, 94, 56, 82, 83, 84, 40, 94, 87, 82, 46],
|
||||||
|
[ 1, 20, 60, 14, 17, 38, 26, 78, 66, 81, 45, 95, 18, 51, 98, 81, 48, 16, 53, 88, 37, 52, 69, 95, 72, 93, 22, 34, 98, 20, 54, 27, 73, 61, 56, 63, 60, 34, 63],
|
||||||
|
[93, 42, 94, 83, 47, 61, 27, 51, 79, 79, 45, 1, 44, 73, 31, 70, 83, 42, 88, 25, 53, 51, 30, 15, 65, 94, 80, 44, 61, 84, 12, 77, 2, 62, 2, 65, 94, 42, 14, 94],
|
||||||
|
[32, 73, 9, 67, 68, 29, 74, 98, 10, 19, 85, 48, 38, 31, 85, 67, 53, 93, 93, 77, 47, 67, 39, 72, 94, 53, 18, 43, 77, 40, 78, 32, 29, 59, 24, 6, 2, 83, 50, 60, 66],
|
||||||
|
[32, 1, 44, 30, 16, 51, 15, 81, 98, 15, 10, 62, 86, 79, 50, 62, 45, 60, 70, 38, 31, 85, 65, 61, 64, 6, 69, 84, 14, 22, 56, 43, 9, 48, 66, 69, 83, 91, 60, 40, 36, 61],
|
||||||
|
[92, 48, 22, 99, 15, 95, 64, 43, 1, 16, 94, 2, 99, 19, 17, 69, 11, 58, 97, 56, 89, 31, 77, 45, 67, 96, 12, 73, 8, 20, 36, 47, 81, 44, 50, 64, 68, 85, 40, 81, 85, 52, 9],
|
||||||
|
[91, 35, 92, 45, 32, 84, 62, 15, 19, 64, 21, 66, 6, 1, 52, 80, 62, 59, 12, 25, 88, 28, 91, 50, 40, 16, 22, 99, 92, 79, 87, 51, 21, 77, 74, 77, 7, 42, 38, 42, 74, 83, 2, 5],
|
||||||
|
[46, 19, 77, 66, 24, 18, 5, 32, 2, 84, 31, 99, 92, 58, 96, 72, 91, 36, 62, 99, 55, 29, 53, 42, 12, 37, 26, 58, 89, 50, 66, 19, 82, 75, 12, 48, 24, 87, 91, 85, 2, 7, 3, 76, 86],
|
||||||
|
[99, 98, 84, 93, 7, 17, 33, 61, 92, 20, 66, 60, 24, 66, 40, 30, 67, 5, 37, 29, 24, 96, 3, 27, 70, 62, 13, 4, 45, 47, 59, 88, 43, 20, 66, 15, 46, 92, 30, 4, 71, 66, 78, 70, 53, 99],
|
||||||
|
[67, 60, 38, 6, 88, 4, 17, 72, 10, 99, 71, 7, 42, 25, 54, 5, 26, 64, 91, 50, 45, 71, 6, 30, 67, 48, 69, 82, 8, 56, 80, 67, 18, 46, 66, 63, 1, 20, 8, 80, 47, 7, 91, 16, 3, 79, 87],
|
||||||
|
[18, 54, 78, 49, 80, 48, 77, 40, 68, 23, 60, 88, 58, 80, 33, 57, 11, 69, 55, 53, 64, 2, 94, 49, 60, 92, 16, 35, 81, 21, 82, 96, 25, 24, 96, 18, 2, 5, 49, 3, 50, 77, 6, 32, 84, 27, 18, 38],
|
||||||
|
[68, 1, 50, 4, 3, 21, 42, 94, 53, 24, 89, 5, 92, 26, 52, 36, 68, 11, 85, 1, 4, 42, 2, 45, 15, 6, 50, 4, 53, 73, 25, 74, 81, 88, 98, 21, 67, 84, 79, 97, 99, 20, 95, 4, 40, 46, 2, 58, 87],
|
||||||
|
[94, 10, 2, 78, 88, 52, 21, 3, 88, 60, 6, 53, 49, 71, 20, 91, 12, 65, 7, 49, 21, 22, 11, 41, 58, 99, 36, 16, 9, 48, 17, 24, 52, 36, 23, 15, 72, 16, 84, 56, 2, 99, 43, 76, 81, 71, 29, 39, 49, 17],
|
||||||
|
[64, 39, 59, 84, 86, 16, 17, 66, 3, 9, 43, 6, 64, 18, 63, 29, 68, 6, 23, 7, 87, 14, 26, 35, 17, 12, 98, 41, 53, 64, 78, 18, 98, 27, 28, 84, 80, 67, 75, 62, 10, 11, 76, 90, 54, 10, 5, 54, 41, 39, 66],
|
||||||
|
[43, 83, 18, 37, 32, 31, 52, 29, 95, 47, 8, 76, 35, 11, 4, 53, 35, 43, 34, 10, 52, 57, 12, 36, 20, 39, 40, 55, 78, 44, 7, 31, 38, 26, 8, 15, 56, 88, 86, 1, 52, 62, 10, 24, 32, 5, 60, 65, 53, 28, 57, 99],
|
||||||
|
[ 3, 50, 3, 52, 7, 73, 49, 92, 66, 80, 1, 46, 8, 67, 25, 36, 73, 93, 7, 42, 25, 53, 13, 96, 76, 83, 87, 90, 54, 89, 78, 22, 78, 91, 73, 51, 69, 9, 79, 94, 83, 53, 9, 40, 69, 62, 10, 79, 49, 47, 3, 81, 30],
|
||||||
|
[71, 54, 73, 33, 51, 76, 59, 54, 79, 37, 56, 45, 84, 17, 62, 21, 98, 69, 41, 95, 65, 24, 39, 37, 62, 3, 24, 48, 54, 64, 46, 82, 71, 78, 33, 67, 9, 16, 96, 68, 52, 74, 79, 68, 32, 21, 13, 78, 96, 60, 9, 69, 20, 36],
|
||||||
|
[73, 26, 21, 44, 46, 38, 17, 83, 65, 98, 7, 23, 52, 46, 61, 97, 33, 13, 60, 31, 70, 15, 36, 77, 31, 58, 56, 93, 75, 68, 21, 36, 69, 53, 90, 75, 25, 82, 39, 50, 65, 94, 29, 30, 11, 33, 11, 13, 96, 2, 56, 47, 7, 49, 2],
|
||||||
|
[76, 46, 73, 30, 10, 20, 60, 70, 14, 56, 34, 26, 37, 39, 48, 24, 55, 76, 84, 91, 39, 86, 95, 61, 50, 14, 53, 93, 64, 67, 37, 31, 10, 84, 42, 70, 48, 20, 10, 72, 60, 61, 84, 79, 69, 65, 99, 73, 89, 25, 85, 48, 92, 56, 97, 16],
|
||||||
|
[ 3, 14, 80, 27, 22, 30, 44, 27, 67, 75, 79, 32, 51, 54, 81, 29, 65, 14, 19, 4, 13, 82, 4, 91, 43, 40, 12, 52, 29, 99, 7, 76, 60, 25, 1, 7, 61, 71, 37, 92, 40, 47, 99, 66, 57, 1, 43, 44, 22, 40, 53, 53, 9, 69, 26, 81, 7],
|
||||||
|
[49, 80, 56, 90, 93, 87, 47, 13, 75, 28, 87, 23, 72, 79, 32, 18, 27, 20, 28, 10, 37, 59, 21, 18, 70, 4, 79, 96, 3, 31, 45, 71, 81, 6, 14, 18, 17, 5, 31, 50, 92, 79, 23, 47, 9, 39, 47, 91, 43, 54, 69, 47, 42, 95, 62, 46, 32, 85],
|
||||||
|
[37, 18, 62, 85, 87, 28, 64, 5, 77, 51, 47, 26, 30, 65, 5, 70, 65, 75, 59, 80, 42, 52, 25, 20, 44, 10, 92, 17, 71, 95, 52, 14, 77, 13, 24, 55, 11, 65, 26, 91, 1, 30, 63, 15, 49, 48, 41, 17, 67, 47, 3, 68, 20, 90, 98, 32, 4, 40, 68],
|
||||||
|
[90, 51, 58, 60, 6, 55, 23, 68, 5, 19, 76, 94, 82, 36, 96, 43, 38, 90, 87, 28, 33, 83, 5, 17, 70, 83, 96, 93, 6, 4, 78, 47, 80, 6, 23, 84, 75, 23, 87, 72, 99, 14, 50, 98, 92, 38, 90, 64, 61, 58, 76, 94, 36, 66, 87, 80, 51, 35, 61, 38],
|
||||||
|
[57, 95, 64, 6, 53, 36, 82, 51, 40, 33, 47, 14, 7, 98, 78, 65, 39, 58, 53, 6, 50, 53, 4, 69, 40, 68, 36, 69, 75, 78, 75, 60, 3, 32, 39, 24, 74, 47, 26, 90, 13, 40, 44, 71, 90, 76, 51, 24, 36, 50, 25, 45, 70, 80, 61, 80, 61, 43, 90, 64, 11],
|
||||||
|
[18, 29, 86, 56, 68, 42, 79, 10, 42, 44, 30, 12, 96, 18, 23, 18, 52, 59, 2, 99, 67, 46, 60, 86, 43, 38, 55, 17, 44, 93, 42, 21, 55, 14, 47, 34, 55, 16, 49, 24, 23, 29, 96, 51, 55, 10, 46, 53, 27, 92, 27, 46, 63, 57, 30, 65, 43, 27, 21, 20, 24, 83],
|
||||||
|
[81, 72, 93, 19, 69, 52, 48, 1, 13, 83, 92, 69, 20, 48, 69, 59, 20, 62, 5, 42, 28, 89, 90, 99, 32, 72, 84, 17, 8, 87, 36, 3, 60, 31, 36, 36, 81, 26, 97, 36, 48, 54, 56, 56, 27, 16, 91, 8, 23, 11, 87, 99, 33, 47, 2, 14, 44, 73, 70, 99, 43, 35, 33],
|
||||||
|
[90, 56, 61, 86, 56, 12, 70, 59, 63, 32, 1, 15, 81, 47, 71, 76, 95, 32, 65, 80, 54, 70, 34, 51, 40, 45, 33, 4, 64, 55, 78, 68, 88, 47, 31, 47, 68, 87, 3, 84, 23, 44, 89, 72, 35, 8, 31, 76, 63, 26, 90, 85, 96, 67, 65, 91, 19, 14, 17, 86, 4, 71, 32, 95],
|
||||||
|
[37, 13, 4, 22, 64, 37, 37, 28, 56, 62, 86, 33, 7, 37, 10, 44, 52, 82, 52, 6, 19, 52, 57, 75, 90, 26, 91, 24, 6, 21, 14, 67, 76, 30, 46, 14, 35, 89, 89, 41, 3, 64, 56, 97, 87, 63, 22, 34, 3, 79, 17, 45, 11, 53, 25, 56, 96, 61, 23, 18, 63, 31, 37, 37, 47],
|
||||||
|
[77, 23, 26, 70, 72, 76, 77, 4, 28, 64, 71, 69, 14, 85, 96, 54, 95, 48, 6, 62, 99, 83, 86, 77, 97, 75, 71, 66, 30, 19, 57, 90, 33, 1, 60, 61, 14, 12, 90, 99, 32, 77, 56, 41, 18, 14, 87, 49, 10, 14, 90, 64, 18, 50, 21, 74, 14, 16, 88, 5, 45, 73, 82, 47, 74, 44],
|
||||||
|
[22, 97, 41, 13, 34, 31, 54, 61, 56, 94, 3, 24, 59, 27, 98, 77, 4, 9, 37, 40, 12, 26, 87, 9, 71, 70, 7, 18, 64, 57, 80, 21, 12, 71, 83, 94, 60, 39, 73, 79, 73, 19, 97, 32, 64, 29, 41, 7, 48, 84, 85, 67, 12, 74, 95, 20, 24, 52, 41, 67, 56, 61, 29, 93, 35, 72, 69],
|
||||||
|
[72, 23, 63, 66, 1, 11, 7, 30, 52, 56, 95, 16, 65, 26, 83, 90, 50, 74, 60, 18, 16, 48, 43, 77, 37, 11, 99, 98, 30, 94, 91, 26, 62, 73, 45, 12, 87, 73, 47, 27, 1, 88, 66, 99, 21, 41, 95, 80, 2, 53, 23, 32, 61, 48, 32, 43, 43, 83, 14, 66, 95, 91, 19, 81, 80, 67, 25, 88],
|
||||||
|
[ 8, 62, 32, 18, 92, 14, 83, 71, 37, 96, 11, 83, 39, 99, 5, 16, 23, 27, 10, 67, 2, 25, 44, 11, 55, 31, 46, 64, 41, 56, 44, 74, 26, 81, 51, 31, 45, 85, 87, 9, 81, 95, 22, 28, 76, 69, 46, 48, 64, 87, 67, 76, 27, 89, 31, 11, 74, 16, 62, 3, 60, 94, 42, 47, 9, 34, 94, 93, 72],
|
||||||
|
[56, 18, 90, 18, 42, 17, 42, 32, 14, 86, 6, 53, 33, 95, 99, 35, 29, 15, 44, 20, 49, 59, 25, 54, 34, 59, 84, 21, 23, 54, 35, 90, 78, 16, 93, 13, 37, 88, 54, 19, 86, 67, 68, 55, 66, 84, 65, 42, 98, 37, 87, 56, 33, 28, 58, 38, 28, 38, 66, 27, 52, 21, 81, 15, 8, 22, 97, 32, 85, 27],
|
||||||
|
[91, 53, 40, 28, 13, 34, 91, 25, 1, 63, 50, 37, 22, 49, 71, 58, 32, 28, 30, 18, 68, 94, 23, 83, 63, 62, 94, 76, 80, 41, 90, 22, 82, 52, 29, 12, 18, 56, 10, 8, 35, 14, 37, 57, 23, 65, 67, 40, 72, 39, 93, 39, 70, 89, 40, 34, 7, 46, 94, 22, 20, 5, 53, 64, 56, 30, 5, 56, 61, 88, 27],
|
||||||
|
[23, 95, 11, 12, 37, 69, 68, 24, 66, 10, 87, 70, 43, 50, 75, 7, 62, 41, 83, 58, 95, 93, 89, 79, 45, 39, 2, 22, 5, 22, 95, 43, 62, 11, 68, 29, 17, 40, 26, 44, 25, 71, 87, 16, 70, 85, 19, 25, 59, 94, 90, 41, 41, 80, 61, 70, 55, 60, 84, 33, 95, 76, 42, 63, 15, 9, 3, 40, 38, 12, 3, 32],
|
||||||
|
[ 9, 84, 56, 80, 61, 55, 85, 97, 16, 94, 82, 94, 98, 57, 84, 30, 84, 48, 93, 90, 71, 5, 95, 90, 73, 17, 30, 98, 40, 64, 65, 89, 7, 79, 9, 19, 56, 36, 42, 30, 23, 69, 73, 72, 7, 5, 27, 61, 24, 31, 43, 48, 71, 84, 21, 28, 26, 65, 65, 59, 65, 74, 77, 20, 10, 81, 61, 84, 95, 8, 52, 23, 70],
|
||||||
|
[47, 81, 28, 9, 98, 51, 67, 64, 35, 51, 59, 36, 92, 82, 77, 65, 80, 24, 72, 53, 22, 7, 27, 10, 21, 28, 30, 22, 48, 82, 80, 48, 56, 20, 14, 43, 18, 25, 50, 95, 90, 31, 77, 8, 9, 48, 44, 80, 90, 22, 93, 45, 82, 17, 13, 96, 25, 26, 8, 73, 34, 99, 6, 49, 24, 6, 83, 51, 40, 14, 15, 10, 25, 1],
|
||||||
|
[54, 25, 10, 81, 30, 64, 24, 74, 75, 80, 36, 75, 82, 60, 22, 69, 72, 91, 45, 67, 3, 62, 79, 54, 89, 74, 44, 83, 64, 96, 66, 73, 44, 30, 74, 50, 37, 5, 9, 97, 70, 1, 60, 46, 37, 91, 39, 75, 75, 18, 58, 52, 72, 78, 51, 81, 86, 52, 8, 97, 1, 46, 43, 66, 98, 62, 81, 18, 70, 93, 73, 8, 32, 46, 34],
|
||||||
|
[96, 80, 82, 7, 59, 71, 92, 53, 19, 20, 88, 66, 3, 26, 26, 10, 24, 27, 50, 82, 94, 73, 63, 8, 51, 33, 22, 45, 19, 13, 58, 33, 90, 15, 22, 50, 36, 13, 55, 6, 35, 47, 82, 52, 33, 61, 36, 27, 28, 46, 98, 14, 73, 20, 73, 32, 16, 26, 80, 53, 47, 66, 76, 38, 94, 45, 2, 1, 22, 52, 47, 96, 64, 58, 52, 39],
|
||||||
|
[88, 46, 23, 39, 74, 63, 81, 64, 20, 90, 33, 33, 76, 55, 58, 26, 10, 46, 42, 26, 74, 74, 12, 83, 32, 43, 9, 2, 73, 55, 86, 54, 85, 34, 28, 23, 29, 79, 91, 62, 47, 41, 82, 87, 99, 22, 48, 90, 20, 5, 96, 75, 95, 4, 43, 28, 81, 39, 81, 1, 28, 42, 78, 25, 39, 77, 90, 57, 58, 98, 17, 36, 73, 22, 63, 74, 51],
|
||||||
|
[29, 39, 74, 94, 95, 78, 64, 24, 38, 86, 63, 87, 93, 6, 70, 92, 22, 16, 80, 64, 29, 52, 20, 27, 23, 50, 14, 13, 87, 15, 72, 96, 81, 22, 8, 49, 72, 30, 70, 24, 79, 31, 16, 64, 59, 21, 89, 34, 96, 91, 48, 76, 43, 53, 88, 1, 57, 80, 23, 81, 90, 79, 58, 1, 80, 87, 17, 99, 86, 90, 72, 63, 32, 69, 14, 28, 88, 69],
|
||||||
|
[37, 17, 71, 95, 56, 93, 71, 35, 43, 45, 4, 98, 92, 94, 84, 96, 11, 30, 31, 27, 31, 60, 92, 3, 48, 5, 98, 91, 86, 94, 35, 90, 90, 8, 48, 19, 33, 28, 68, 37, 59, 26, 65, 96, 50, 68, 22, 7, 9, 49, 34, 31, 77, 49, 43, 6, 75, 17, 81, 87, 61, 79, 52, 26, 27, 72, 29, 50, 7, 98, 86, 1, 17, 10, 46, 64, 24, 18, 56],
|
||||||
|
[51, 30, 25, 94, 88, 85, 79, 91, 40, 33, 63, 84, 49, 67, 98, 92, 15, 26, 75, 19, 82, 5, 18, 78, 65, 93, 61, 48, 91, 43, 59, 41, 70, 51, 22, 15, 92, 81, 67, 91, 46, 98, 11, 11, 65, 31, 66, 10, 98, 65, 83, 21, 5, 56, 5, 98, 73, 67, 46, 74, 69, 34, 8, 30, 5, 52, 7, 98, 32, 95, 30, 94, 65, 50, 24, 63, 28, 81, 99, 57],
|
||||||
|
[19, 23, 61, 36, 9, 89, 71, 98, 65, 17, 30, 29, 89, 26, 79, 74, 94, 11, 44, 48, 97, 54, 81, 55, 39, 66, 69, 45, 28, 47, 13, 86, 15, 76, 74, 70, 84, 32, 36, 33, 79, 20, 78, 14, 41, 47, 89, 28, 81, 5, 99, 66, 81, 86, 38, 26, 6, 25, 13, 60, 54, 55, 23, 53, 27, 5, 89, 25, 23, 11, 13, 54, 59, 54, 56, 34, 16, 24, 53, 44, 6],
|
||||||
|
[13, 40, 57, 72, 21, 15, 60, 8, 4, 19, 11, 98, 34, 45, 9, 97, 86, 71, 3, 15, 56, 19, 15, 44, 97, 31, 90, 4, 87, 87, 76, 8, 12, 30, 24, 62, 84, 28, 12, 85, 82, 53, 99, 52, 13, 94, 6, 65, 97, 86, 9, 50, 94, 68, 69, 74, 30, 67, 87, 94, 63, 7, 78, 27, 80, 36, 69, 41, 6, 92, 32, 78, 37, 82, 30, 5, 18, 87, 99, 72, 19, 99],
|
||||||
|
[44, 20, 55, 77, 69, 91, 27, 31, 28, 81, 80, 27, 2, 7, 97, 23, 95, 98, 12, 25, 75, 29, 47, 71, 7, 47, 78, 39, 41, 59, 27, 76, 13, 15, 66, 61, 68, 35, 69, 86, 16, 53, 67, 63, 99, 85, 41, 56, 8, 28, 33, 40, 94, 76, 90, 85, 31, 70, 24, 65, 84, 65, 99, 82, 19, 25, 54, 37, 21, 46, 33, 2, 52, 99, 51, 33, 26, 4, 87, 2, 8, 18, 96],
|
||||||
|
[54, 42, 61, 45, 91, 6, 64, 79, 80, 82, 32, 16, 83, 63, 42, 49, 19, 78, 65, 97, 40, 42, 14, 61, 49, 34, 4, 18, 25, 98, 59, 30, 82, 72, 26, 88, 54, 36, 21, 75, 3, 88, 99, 53, 46, 51, 55, 78, 22, 94, 34, 40, 68, 87, 84, 25, 30, 76, 25, 8, 92, 84, 42, 61, 40, 38, 9, 99, 40, 23, 29, 39, 46, 55, 10, 90, 35, 84, 56, 70, 63, 23, 91, 39],
|
||||||
|
[52, 92, 3, 71, 89, 7, 9, 37, 68, 66, 58, 20, 44, 92, 51, 56, 13, 71, 79, 99, 26, 37, 2, 6, 16, 67, 36, 52, 58, 16, 79, 73, 56, 60, 59, 27, 44, 77, 94, 82, 20, 50, 98, 33, 9, 87, 94, 37, 40, 83, 64, 83, 58, 85, 17, 76, 53, 2, 83, 52, 22, 27, 39, 20, 48, 92, 45, 21, 9, 42, 24, 23, 12, 37, 52, 28, 50, 78, 79, 20, 86, 62, 73, 20, 59],
|
||||||
|
[54, 96, 80, 15, 91, 90, 99, 70, 10, 9, 58, 90, 93, 50, 81, 99, 54, 38, 36, 10, 30, 11, 35, 84, 16, 45, 82, 18, 11, 97, 36, 43, 96, 79, 97, 65, 40, 48, 23, 19, 17, 31, 64, 52, 65, 65, 37, 32, 65, 76, 99, 79, 34, 65, 79, 27, 55, 33, 3, 1, 33, 27, 61, 28, 66, 8, 4, 70, 49, 46, 48, 83, 1, 45, 19, 96, 13, 81, 14, 21, 31, 79, 93, 85, 50, 5],
|
||||||
|
[92, 92, 48, 84, 59, 98, 31, 53, 23, 27, 15, 22, 79, 95, 24, 76, 5, 79, 16, 93, 97, 89, 38, 89, 42, 83, 2, 88, 94, 95, 82, 21, 1, 97, 48, 39, 31, 78, 9, 65, 50, 56, 97, 61, 1, 7, 65, 27, 21, 23, 14, 15, 80, 97, 44, 78, 49, 35, 33, 45, 81, 74, 34, 5, 31, 57, 9, 38, 94, 7, 69, 54, 69, 32, 65, 68, 46, 68, 78, 90, 24, 28, 49, 51, 45, 86, 35],
|
||||||
|
[41, 63, 89, 76, 87, 31, 86, 9, 46, 14, 87, 82, 22, 29, 47, 16, 13, 10, 70, 72, 82, 95, 48, 64, 58, 43, 13, 75, 42, 69, 21, 12, 67, 13, 64, 85, 58, 23, 98, 9, 37, 76, 5, 22, 31, 12, 66, 50, 29, 99, 86, 72, 45, 25, 10, 28, 19, 6, 90, 43, 29, 31, 67, 79, 46, 25, 74, 14, 97, 35, 76, 37, 65, 46, 23, 82, 6, 22, 30, 76, 93, 66, 94, 17, 96, 13, 20, 72],
|
||||||
|
[63, 40, 78, 8, 52, 9, 90, 41, 70, 28, 36, 14, 46, 44, 85, 96, 24, 52, 58, 15, 87, 37, 5, 98, 99, 39, 13, 61, 76, 38, 44, 99, 83, 74, 90, 22, 53, 80, 56, 98, 30, 51, 63, 39, 44, 30, 91, 91, 4, 22, 27, 73, 17, 35, 53, 18, 35, 45, 54, 56, 27, 78, 48, 13, 69, 36, 44, 38, 71, 25, 30, 56, 15, 22, 73, 43, 32, 69, 59, 25, 93, 83, 45, 11, 34, 94, 44, 39, 92],
|
||||||
|
[12, 36, 56, 88, 13, 96, 16, 12, 55, 54, 11, 47, 19, 78, 17, 17, 68, 81, 77, 51, 42, 55, 99, 85, 66, 27, 81, 79, 93, 42, 65, 61, 69, 74, 14, 1, 18, 56, 12, 1, 58, 37, 91, 22, 42, 66, 83, 25, 19, 4, 96, 41, 25, 45, 18, 69, 96, 88, 36, 93, 10, 12, 98, 32, 44, 83, 83, 4, 72, 91, 4, 27, 73, 7, 34, 37, 71, 60, 59, 31, 1, 54, 54, 44, 96, 93, 83, 36, 4, 45],
|
||||||
|
[30, 18, 22, 20, 42, 96, 65, 79, 17, 41, 55, 69, 94, 81, 29, 80, 91, 31, 85, 25, 47, 26, 43, 49, 2, 99, 34, 67, 99, 76, 16, 14, 15, 93, 8, 32, 99, 44, 61, 77, 67, 50, 43, 55, 87, 55, 53, 72, 17, 46, 62, 25, 50, 99, 73, 5, 93, 48, 17, 31, 70, 80, 59, 9, 44, 59, 45, 13, 74, 66, 58, 94, 87, 73, 16, 14, 85, 38, 74, 99, 64, 23, 79, 28, 71, 42, 20, 37, 82, 31, 23],
|
||||||
|
[51, 96, 39, 65, 46, 71, 56, 13, 29, 68, 53, 86, 45, 33, 51, 49, 12, 91, 21, 21, 76, 85, 2, 17, 98, 15, 46, 12, 60, 21, 88, 30, 92, 83, 44, 59, 42, 50, 27, 88, 46, 86, 94, 73, 45, 54, 23, 24, 14, 10, 94, 21, 20, 34, 23, 51, 4, 83, 99, 75, 90, 63, 60, 16, 22, 33, 83, 70, 11, 32, 10, 50, 29, 30, 83, 46, 11, 5, 31, 17, 86, 42, 49, 1, 44, 63, 28, 60, 7, 78, 95, 40],
|
||||||
|
[44, 61, 89, 59, 4, 49, 51, 27, 69, 71, 46, 76, 44, 4, 9, 34, 56, 39, 15, 6, 94, 91, 75, 90, 65, 27, 56, 23, 74, 6, 23, 33, 36, 69, 14, 39, 5, 34, 35, 57, 33, 22, 76, 46, 56, 10, 61, 65, 98, 9, 16, 69, 4, 62, 65, 18, 99, 76, 49, 18, 72, 66, 73, 83, 82, 40, 76, 31, 89, 91, 27, 88, 17, 35, 41, 35, 32, 51, 32, 67, 52, 68, 74, 85, 80, 57, 7, 11, 62, 66, 47, 22, 67],
|
||||||
|
[65, 37, 19, 97, 26, 17, 16, 24, 24, 17, 50, 37, 64, 82, 24, 36, 32, 11, 68, 34, 69, 31, 32, 89, 79, 93, 96, 68, 49, 90, 14, 23, 4, 4, 67, 99, 81, 74, 70, 74, 36, 96, 68, 9, 64, 39, 88, 35, 54, 89, 96, 58, 66, 27, 88, 97, 32, 14, 6, 35, 78, 20, 71, 6, 85, 66, 57, 2, 58, 91, 72, 5, 29, 56, 73, 48, 86, 52, 9, 93, 22, 57, 79, 42, 12, 1, 31, 68, 17, 59, 63, 76, 7, 77],
|
||||||
|
[73, 81, 14, 13, 17, 20, 11, 9, 1, 83, 8, 85, 91, 70, 84, 63, 62, 77, 37, 7, 47, 1, 59, 95, 39, 69, 39, 21, 99, 9, 87, 2, 97, 16, 92, 36, 74, 71, 90, 66, 33, 73, 73, 75, 52, 91, 11, 12, 26, 53, 5, 26, 26, 48, 61, 50, 90, 65, 1, 87, 42, 47, 74, 35, 22, 73, 24, 26, 56, 70, 52, 5, 48, 41, 31, 18, 83, 27, 21, 39, 80, 85, 26, 8, 44, 2, 71, 7, 63, 22, 5, 52, 19, 8, 20],
|
||||||
|
[17, 25, 21, 11, 72, 93, 33, 49, 64, 23, 53, 82, 3, 13, 91, 65, 85, 2, 40, 5, 42, 31, 77, 42, 5, 36, 6, 54, 4, 58, 7, 76, 87, 83, 25, 57, 66, 12, 74, 33, 85, 37, 74, 32, 20, 69, 3, 97, 91, 68, 82, 44, 19, 14, 89, 28, 85, 85, 80, 53, 34, 87, 58, 98, 88, 78, 48, 65, 98, 40, 11, 57, 10, 67, 70, 81, 60, 79, 74, 72, 97, 59, 79, 47, 30, 20, 54, 80, 89, 91, 14, 5, 33, 36, 79, 39],
|
||||||
|
[60, 85, 59, 39, 60, 7, 57, 76, 77, 92, 6, 35, 15, 72, 23, 41, 45, 52, 95, 18, 64, 79, 86, 53, 56, 31, 69, 11, 91, 31, 84, 50, 44, 82, 22, 81, 41, 40, 30, 42, 30, 91, 48, 94, 74, 76, 64, 58, 74, 25, 96, 57, 14, 19, 3, 99, 28, 83, 15, 75, 99, 1, 89, 85, 79, 50, 3, 95, 32, 67, 44, 8, 7, 41, 62, 64, 29, 20, 14, 76, 26, 55, 48, 71, 69, 66, 19, 72, 44, 25, 14, 1, 48, 74, 12, 98, 7],
|
||||||
|
[64, 66, 84, 24, 18, 16, 27, 48, 20, 14, 47, 69, 30, 86, 48, 40, 23, 16, 61, 21, 51, 50, 26, 47, 35, 33, 91, 28, 78, 64, 43, 68, 4, 79, 51, 8, 19, 60, 52, 95, 6, 68, 46, 86, 35, 97, 27, 58, 4, 65, 30, 58, 99, 12, 12, 75, 91, 39, 50, 31, 42, 64, 70, 4, 46, 7, 98, 73, 98, 93, 37, 89, 77, 91, 64, 71, 64, 65, 66, 21, 78, 62, 81, 74, 42, 20, 83, 70, 73, 95, 78, 45, 92, 27, 34, 53, 71, 15],
|
||||||
|
[30, 11, 85, 31, 34, 71, 13, 48, 5, 14, 44, 3, 19, 67, 23, 73, 19, 57, 6, 90, 94, 72, 57, 69, 81, 62, 59, 68, 88, 57, 55, 69, 49, 13, 7, 87, 97, 80, 89, 5, 71, 5, 5, 26, 38, 40, 16, 62, 45, 99, 18, 38, 98, 24, 21, 26, 62, 74, 69, 4, 85, 57, 77, 35, 58, 67, 91, 79, 79, 57, 86, 28, 66, 34, 72, 51, 76, 78, 36, 95, 63, 90, 8, 78, 47, 63, 45, 31, 22, 70, 52, 48, 79, 94, 15, 77, 61, 67, 68],
|
||||||
|
[23, 33, 44, 81, 80, 92, 93, 75, 94, 88, 23, 61, 39, 76, 22, 3, 28, 94, 32, 6, 49, 65, 41, 34, 18, 23, 8, 47, 62, 60, 3, 63, 33, 13, 80, 52, 31, 54, 73, 43, 70, 26, 16, 69, 57, 87, 83, 31, 3, 93, 70, 81, 47, 95, 77, 44, 29, 68, 39, 51, 56, 59, 63, 7, 25, 70, 7, 77, 43, 53, 64, 3, 94, 42, 95, 39, 18, 1, 66, 21, 16, 97, 20, 50, 90, 16, 70, 10, 95, 69, 29, 6, 25, 61, 41, 26, 15, 59, 63, 35]]
|
||||||
|
__numRows = 100
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("Find the maximum total from top to bottom")
|
||||||
|
self.foundPoints = [] #For the points that I have already found the shortest distance to
|
||||||
|
self.possiblePoints = [] #For the locations you are checking this round
|
||||||
|
self.actualTotal = 0 #The true total of the path from the top to the bottom
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Invert the list so that each element = 100 - element
|
||||||
|
self.invert()
|
||||||
|
|
||||||
|
#Add the tip of the pyramid because everything has to go through that
|
||||||
|
self.foundPoints.append(self.location(0, 0, self.__listNum[0][0], True))
|
||||||
|
#Add the second row as possible points because everything must pass through the second row
|
||||||
|
self.possiblePoints.append(self.location(0, 1, (self.__listNum[0][0] + self.__listNum[1][0]), True))
|
||||||
|
self.possiblePoints.append(self.location(1, 1, (self.__listNum[0][0] + self.__listNum[1][1]), False))
|
||||||
|
foundBottom = False
|
||||||
|
|
||||||
|
#Loop until you find the bottom
|
||||||
|
while(not foundBottom):
|
||||||
|
#Check which possible point gives us the lowest number. If more than one has the same number simply keep the first one
|
||||||
|
minLoc = self.possiblePoints[0]
|
||||||
|
for loc in self.possiblePoints:
|
||||||
|
if(loc.total < minLoc.total):
|
||||||
|
minLoc = loc
|
||||||
|
|
||||||
|
#Remove it from the list of possible points
|
||||||
|
self.removeIf(self.possiblePoints, minLoc)
|
||||||
|
|
||||||
|
self.foundPoints.append(minLoc)
|
||||||
|
|
||||||
|
#Add to the list of possible points from the point we just found and
|
||||||
|
#If you are at the bottom raise the flag to end the program
|
||||||
|
xLoc = minLoc.xLocation
|
||||||
|
yLoc = minLoc.yLocation + 1
|
||||||
|
if(yLoc >= self.__numRows):
|
||||||
|
foundBottom = True
|
||||||
|
else:
|
||||||
|
self.possiblePoints.append(self.location(xLoc, yLoc, minLoc.total + self.__listNum[yLoc][xLoc], True))
|
||||||
|
xLoc += 1
|
||||||
|
self.possiblePoints.append(self.location(xLoc, yLoc, minLoc.total + self.__listNum[yLoc][xLoc], False))
|
||||||
|
|
||||||
|
#Get the real total of the journey
|
||||||
|
self.actualTotal = ((100 * self.__numRows) - self.foundPoints[len(self.foundPoints) - 1].total)
|
||||||
|
|
||||||
|
#Invert the list so it can be read again
|
||||||
|
self.invert()
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The value of the longest path is " + str(self.actualTotal)
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
|
||||||
|
#This function turns every number in the array into (100 - num) to allow you to find the largest numbers rather than the smallest
|
||||||
|
def invert(self):
|
||||||
|
for rowCnt in range(0, self.__numRows):
|
||||||
|
for colCnt in range(0, len(self.__listNum[rowCnt])):
|
||||||
|
self.__listNum[rowCnt][colCnt] = 100 - self.__listNum[rowCnt][colCnt]
|
||||||
|
#This function removes every element in listNum that is equal to loc
|
||||||
|
def removeIf(self, listNum: list, loc: tuple):
|
||||||
|
location = 0
|
||||||
|
while(location < len(listNum)):
|
||||||
|
if((listNum[location].xLocation == loc.xLocation) and (listNum[location].yLocation == loc.yLocation)):
|
||||||
|
del listNum[location]
|
||||||
|
else:
|
||||||
|
location += 1
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.foundPoints.clear()
|
||||||
|
self.possiblePoints.clear()
|
||||||
|
self.actualTotal = 0
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the pyramid that was traversed as a string
|
||||||
|
def getPyramid(self) -> str:
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the pyramid")
|
||||||
|
|
||||||
|
results = ""
|
||||||
|
#Loop through all elements of the list and print them
|
||||||
|
for row in self.listNum:
|
||||||
|
for column in row:
|
||||||
|
results += "{:02d}".format(column)
|
||||||
|
results += '\n'
|
||||||
|
return results
|
||||||
|
#Returns the trail the algorithm took as a string
|
||||||
|
def getTrail(self) -> str:
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the trail")
|
||||||
|
#TODO: Implement this
|
||||||
|
return ""
|
||||||
|
#Returns the total that was asked for
|
||||||
|
def getTotal(self) -> int:
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the total")
|
||||||
|
return self.actualTotal
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem67()
|
||||||
|
print(problem.getDescription()) #Print the description
|
||||||
|
problem.solve() #Call the function that answers the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
""" Results:
|
||||||
|
The value of the longest path is 7273
|
||||||
|
It took 16.483 seconds to run this algorithm
|
||||||
|
"""
|
||||||
87
Problems/Problem7.py
Normal file
87
Problems/Problem7.py
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
#Project Eulter/Python/Problem7.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 01-29-19
|
||||||
|
#Modified: 07-18-20
|
||||||
|
#What is the 10001th prime number?
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
from Algorithms import getNumPrimes
|
||||||
|
|
||||||
|
|
||||||
|
class Problem7(Problem):
|
||||||
|
#Variables
|
||||||
|
__numPrimes = 10001 #The number of the prime number desired
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("What is the 10001th prime number?")
|
||||||
|
self.primes = []
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Get the correct number of primes
|
||||||
|
self.primes = getNumPrimes(self.__numPrimes)
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The " + str(self.__numPrimes) + "th prime number is " + str(self.primes[self.__numPrimes - 1])
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.primes.clear()
|
||||||
|
#Gets
|
||||||
|
#Returns the requested prime number
|
||||||
|
def getPrime(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the requested prime")
|
||||||
|
return self.primes[len(self.primes) - 1]
|
||||||
|
|
||||||
|
#If you are running this file, automatically start the correct function
|
||||||
|
if __name__ == '__main__':
|
||||||
|
problem = Problem7()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
|
||||||
|
"""Results:
|
||||||
|
The 10001th prime number is 104743
|
||||||
|
It took 139.545 milliseconds to run this algorithm
|
||||||
|
"""
|
||||||
126
Problems/Problem8.py
Normal file
126
Problems/Problem8.py
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
#Project Euler/Python/Problem8.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 01-29-19
|
||||||
|
#Modified: 07-18-20
|
||||||
|
#Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product?
|
||||||
|
"""
|
||||||
|
73167176531330624919225119674426574742355349194934
|
||||||
|
96983520312774506326239578318016984801869478851843
|
||||||
|
85861560789112949495459501737958331952853208805511
|
||||||
|
12540698747158523863050715693290963295227443043557
|
||||||
|
66896648950445244523161731856403098711121722383113
|
||||||
|
62229893423380308135336276614282806444486645238749
|
||||||
|
30358907296290491560440772390713810515859307960866
|
||||||
|
70172427121883998797908792274921901699720888093776
|
||||||
|
65727333001053367881220235421809751254540594752243
|
||||||
|
52584907711670556013604839586446706324415722155397
|
||||||
|
53697817977846174064955149290862569321978468622482
|
||||||
|
83972241375657056057490261407972968652414535100474
|
||||||
|
82166370484403199890008895243450658541227588666881
|
||||||
|
16427171479924442928230863465674813919123162824586
|
||||||
|
17866458359124566529476545682848912883142607690042
|
||||||
|
24219022671055626321111109370544217506941658960408
|
||||||
|
07198403850962455444362981230987879927244284909188
|
||||||
|
84580156166097919133875499200524063689912560717606
|
||||||
|
05886116467109405077541002256983155200055935729725
|
||||||
|
71636269561882670428252483600823257530420752963450
|
||||||
|
"""
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
|
class Problem8(Problem):
|
||||||
|
#Variables
|
||||||
|
#The number
|
||||||
|
__number = "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450"
|
||||||
|
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product?")
|
||||||
|
self.maxNums = "" #Holds the string of the largest product
|
||||||
|
self.maxProduct = 0 #Holds the largest product of 13 numbers
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Start at the 13th entry and multiply all single digit numbers before and including that number together
|
||||||
|
cnt = 12 #The location in the number that you are working from
|
||||||
|
for cnt in range(12, len(self.__number)):
|
||||||
|
currentProduct = int(self.__number[cnt]) * int(self.__number[cnt - 1]) * int(self.__number[cnt - 2]) * int(self.__number[cnt - 3]) * int(self.__number[cnt - 4]) * int(self.__number[cnt - 5]) * int(self.__number[cnt - 6]) * int(self.__number[cnt - 7]) * int(self.__number[cnt - 8]) * int(self.__number[cnt - 9]) * int(self.__number[cnt - 10]) * int(self.__number[cnt - 11]) * int(self.__number[cnt - 12])
|
||||||
|
#Save the largest product
|
||||||
|
if(currentProduct > self.maxProduct):
|
||||||
|
self.maxProduct = currentProduct
|
||||||
|
self.maxNums = self.__number[cnt - 12:cnt + 1] #Have to add one because it stops before the second subscript
|
||||||
|
#Move to the next location
|
||||||
|
cnt += 1
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
self.result = "The largest product of 13 adjacent digits in the number is " + str(self.maxProduct) + "\nThe numbers are: " + self.maxNums
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
maxNums = ""
|
||||||
|
maxProduct = 0
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the string of number that produces the largest product
|
||||||
|
def getLargestNums(self) -> str:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the nums the produce the largest product")
|
||||||
|
return self.maxNums
|
||||||
|
#Returns the requested product
|
||||||
|
def getLargestProduct(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the requested product")
|
||||||
|
return self.maxProduct
|
||||||
|
|
||||||
|
#If you are running this file, automatically start the correct function
|
||||||
|
if __name__ == '__main__':
|
||||||
|
problem = Problem8()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
"""Results:
|
||||||
|
The largest product of 13 adjacent digits in the number is 23514624000
|
||||||
|
The numbers are: 5576689664895
|
||||||
|
It took 2.593 milliseconds to run this algorithm
|
||||||
|
"""
|
||||||
128
Problems/Problem9.py
Normal file
128
Problems/Problem9.py
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
#Project Euler/Python/Problem9.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 01-29-19
|
||||||
|
#Modified: 07-18-20
|
||||||
|
#There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc.
|
||||||
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from Problems.Problem import Problem
|
||||||
|
from Stopwatch import Stopwatch
|
||||||
|
from Unsolved import Unsolved
|
||||||
|
import math
|
||||||
|
|
||||||
|
|
||||||
|
class Problem9(Problem):
|
||||||
|
#Functions
|
||||||
|
#Constructor
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc.")
|
||||||
|
self.a = 1
|
||||||
|
self.b = 0
|
||||||
|
self.c = 0
|
||||||
|
self.found = False
|
||||||
|
|
||||||
|
#Operational functions
|
||||||
|
#Solve the problem
|
||||||
|
def solve(self):
|
||||||
|
#If the problem has already been solved do nothing and end the function
|
||||||
|
if(self.solved):
|
||||||
|
return
|
||||||
|
|
||||||
|
#Start the timer
|
||||||
|
self.timer.start()
|
||||||
|
|
||||||
|
#Start with the lowest possible a , 1, and search for the b and c to complete the triplet
|
||||||
|
while((self.a <= (1000 / 3)) and (not self.found)):
|
||||||
|
#Setup b and c
|
||||||
|
self.b = self.a + 1 #b must be > a to be a triplet
|
||||||
|
self.c = math.hypot(self.a, self.b) #C is the hyp
|
||||||
|
#Loop through possible b's and calculate c's until you find the numbers or the sum gets too large
|
||||||
|
while((self.a + self.b + self.c) < 1000):
|
||||||
|
self.b += 1
|
||||||
|
self.c = math.hypot(self.a, self.b)
|
||||||
|
#If c is an integer make it one
|
||||||
|
if((self.c % 1) == 0):
|
||||||
|
self.c = int(round(self.c))
|
||||||
|
#Check if the correct sides were found
|
||||||
|
if((self.a + self.b + self.c) == 1000):
|
||||||
|
self.found = True
|
||||||
|
#Otherwise increment a to the next possible number
|
||||||
|
else:
|
||||||
|
self.a += 1
|
||||||
|
|
||||||
|
#Stop the timer
|
||||||
|
self.timer.stop()
|
||||||
|
|
||||||
|
#Save the results
|
||||||
|
if(self.found):
|
||||||
|
self.result = "The Pythagorean triplet where a + b + c = 1000 is " + str(self.a) + " " + str(self.b) + " " + str(int(self.c)) + "\nThe product of those numbers is " + str(int(self.a * self.b * self.c))
|
||||||
|
else:
|
||||||
|
self.result = "Could not find the triplet where a + b + c = 1000"
|
||||||
|
|
||||||
|
#Throw a flag to show the problem is solved
|
||||||
|
self.solved = True
|
||||||
|
#Reset the problem so it can be run again
|
||||||
|
def reset(self):
|
||||||
|
super().reset()
|
||||||
|
self.a = 1
|
||||||
|
self.b = 0
|
||||||
|
self.c = 0
|
||||||
|
found = False
|
||||||
|
|
||||||
|
#Gets
|
||||||
|
#Returns the length of the first side
|
||||||
|
def getSideA(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the length of the first side")
|
||||||
|
return self.a
|
||||||
|
#Returns the length of the second side
|
||||||
|
def getSideB(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the length of the second side")
|
||||||
|
return self.b
|
||||||
|
#Returns the length of the hyp
|
||||||
|
def getSideC(self) -> float:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the length of the hyp")
|
||||||
|
return self.c
|
||||||
|
#Returns the product of the 3 sides
|
||||||
|
def getProduct(self) -> int:
|
||||||
|
#If the problem hasn't been solved throw an exception
|
||||||
|
if(not self.solved):
|
||||||
|
raise Unsolved("You must solve the problem before you can get the length first side")
|
||||||
|
return int(self.a * self.b * self.c)
|
||||||
|
|
||||||
|
#If you are running this file, automatically start the correct function
|
||||||
|
if __name__ == "__main__":
|
||||||
|
problem = Problem9()
|
||||||
|
print(problem.getDescription()) #Print the description of the problem
|
||||||
|
problem.solve() #Solve the problem
|
||||||
|
#Print the results
|
||||||
|
print(problem.getResult())
|
||||||
|
print("It took " + problem.getTime() + " to solve this algorithm")
|
||||||
|
|
||||||
|
"""Results:
|
||||||
|
The Pythagorean triplet where a + b + c = 1000 is 200 375 425
|
||||||
|
The product of those numbers is 31875000
|
||||||
|
It took 22.106 milliseconds to run this algorithm
|
||||||
|
"""
|
||||||
0
Problems/__init__.py
Normal file
0
Problems/__init__.py
Normal file
2
ProjectEuler.py
Normal file
2
ProjectEuler.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
from Driver import Driver
|
||||||
|
Driver.main()
|
||||||
26
Unsolved.py
Normal file
26
Unsolved.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#ProjectEulerPython/Unsolved.py
|
||||||
|
#Matthew Ellison
|
||||||
|
# Created: 07-17-20
|
||||||
|
#Modified: 07-17-20
|
||||||
|
#This is an exception that is thrown by the problem classes
|
||||||
|
"""
|
||||||
|
Copyright (C) 2020 Matthew Ellison
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
class Unsolved(Exception):
|
||||||
|
def __init__(self, message: str):
|
||||||
|
#Save a message that can be extracted
|
||||||
|
self.message = message
|
||||||
Reference in New Issue
Block a user