mirror of
https://bitbucket.org/Mattrixwv/projecteulerpython.git
synced 2026-02-04 04:02:29 -05:00
Removed unneccessary imports
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#ProjectEuler/Python/Problem1.py
|
#ProjectEuler/Python/Problem1.py
|
||||||
#Matthew Ellison
|
#Matthew Ellison
|
||||||
# Created: 01-26-19
|
# Created: 01-26-19
|
||||||
#Modified: 10-26-20
|
#Modified: 10-29-20
|
||||||
#What is the sum of all the multiples of 3 or 5 that are less than 1000
|
#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
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ProjectEuler/Python/Problem2.py
|
#ProjectEuler/Python/Problem2.py
|
||||||
#Matthew Ellison
|
#Matthew Ellison
|
||||||
# Created: 01-26-19
|
# Created: 01-26-19
|
||||||
#Modified: 07-17-20
|
#Modified: 10-29-20
|
||||||
#The sum of the even Fibonacci numbers less than 4,000,000
|
#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
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
"""
|
"""
|
||||||
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
|
|
||||||
from Problems.Problem import Problem
|
from Problems.Problem import Problem
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
from Algorithms import getAllFib
|
from Algorithms import getAllFib
|
||||||
from Unsolved import Unsolved
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
@@ -77,6 +76,7 @@ class Problem2(Problem):
|
|||||||
raise Unsolved("You must solve the problem before can you see the sum")
|
raise Unsolved("You must solve the problem before can you see the sum")
|
||||||
return self.fullSum
|
return self.fullSum
|
||||||
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
#If you are running this file, automatically start the correct function
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
problem = Problem2() #Call the function that answers the question
|
problem = Problem2() #Call the function that answers the question
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ProjectEuler/Python/Problem3.py
|
#ProjectEuler/Python/Problem3.py
|
||||||
#Matthew Ellison
|
#Matthew Ellison
|
||||||
# Created: 01-27-19
|
# Created: 01-27-19
|
||||||
#Modified: 07-17-20
|
#Modified: 10-29-20
|
||||||
#The largest prime factor of 600851475143
|
#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
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
"""
|
"""
|
||||||
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
|
|
||||||
from Problems.Problem import Problem
|
from Problems.Problem import Problem
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
from Algorithms import getFactors
|
from Algorithms import getFactors
|
||||||
from Unsolved import Unsolved
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ProjectEuler/Python/Problem4.py
|
#ProjectEuler/Python/Problem4.py
|
||||||
#Matthew Ellison
|
#Matthew Ellison
|
||||||
# Created: 01-28-19
|
# Created: 01-28-19
|
||||||
#Modified: 07-17-20
|
#Modified: 10-29-20
|
||||||
#Find the largest palindrome made from the product of two 3-digit numbers
|
#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
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
"""
|
"""
|
||||||
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
|
|
||||||
from Problems.Problem import Problem
|
from Problems.Problem import Problem
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
from Unsolved import Unsolved
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
@@ -88,6 +87,7 @@ class Problem4(Problem):
|
|||||||
raise Unsolved("You must solve the problem before you can get the largest palindrome")
|
raise Unsolved("You must solve the problem before you can get the largest palindrome")
|
||||||
return self.palindromes[len(self.palindromes) - 1]
|
return self.palindromes[len(self.palindromes) - 1]
|
||||||
|
|
||||||
|
|
||||||
#If you are running this file, automatically start the correct function
|
#If you are running this file, automatically start the correct function
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
problem = Problem4()
|
problem = Problem4()
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ProjectEulter/Python/Project5.py
|
#ProjectEulter/Python/Project5.py
|
||||||
#Matthew Ellison
|
#Matthew Ellison
|
||||||
# Created: 01-28-19
|
# Created: 01-28-19
|
||||||
#Modified: 07-17-20
|
#Modified: 10-29-20
|
||||||
#What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 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
|
#Unless otherwise listed, all of my non-standard imports can be gotten from my pyClasses repository at https://bitbucket.org/Mattrixwv/pyClasses
|
||||||
"""
|
"""
|
||||||
@@ -23,14 +23,13 @@
|
|||||||
|
|
||||||
|
|
||||||
from Problems.Problem import Problem
|
from Problems.Problem import Problem
|
||||||
from Stopwatch import Stopwatch
|
|
||||||
from Unsolved import Unsolved
|
from Unsolved import Unsolved
|
||||||
|
|
||||||
|
|
||||||
class Problem5(Problem):
|
class Problem5(Problem):
|
||||||
#Variables
|
#Variables
|
||||||
__startNum = 1
|
__startDivisor = 1
|
||||||
__stopNum = 20
|
__stopDivisor = 20
|
||||||
|
|
||||||
#Functions
|
#Functions
|
||||||
#Constructor
|
#Constructor
|
||||||
@@ -56,7 +55,7 @@ class Problem5(Problem):
|
|||||||
#Set that it found the number to true, because it sets this flag when it doesn't find it
|
#Set that it found the number to true, because it sets this flag when it doesn't find it
|
||||||
numFound = True
|
numFound = True
|
||||||
#See if the current number is divisible by all numbers from 1 to 20
|
#See if the current number is divisible by all numbers from 1 to 20
|
||||||
for divisor in range(self.__startNum, self.__stopNum + 1):
|
for divisor in range(self.__startDivisor, self.__stopDivisor + 1):
|
||||||
#If it is not set a flag to move to the next possible number
|
#If it is not set a flag to move to the next possible number
|
||||||
if((currentNum % divisor) != 0):
|
if((currentNum % divisor) != 0):
|
||||||
numFound = False
|
numFound = False
|
||||||
@@ -66,6 +65,7 @@ class Problem5(Problem):
|
|||||||
if(not numFound):
|
if(not numFound):
|
||||||
currentNum += 2
|
currentNum += 2
|
||||||
|
|
||||||
|
#Set the smallest number to the number we just found
|
||||||
self.smallestNum = currentNum
|
self.smallestNum = currentNum
|
||||||
|
|
||||||
#Stop the timer
|
#Stop the timer
|
||||||
@@ -92,6 +92,7 @@ class Problem5(Problem):
|
|||||||
raise Unsolved("You must solve the problem before you can get the requested number")
|
raise Unsolved("You must solve the problem before you can get the requested number")
|
||||||
return self.smallestNum
|
return self.smallestNum
|
||||||
|
|
||||||
|
|
||||||
#If it are running this file, automatically start the correct function
|
#If it are running this file, automatically start the correct function
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
problem = Problem5()
|
problem = Problem5()
|
||||||
|
|||||||
Reference in New Issue
Block a user