project-euler-100

[RADIOACTIVE] solutions to the first 100 challenges of project euler
git clone git://git.figbert.com/project-euler-100.git
Log | Files | Refs | README

problem005.py (507B)


      1 # problemName = "Smallest multiple"
      2 # problemNum = 5
      3 # solutionBy = "FIGBERT"
      4 # language = "Python"
      5 # dateCompleted = "21/01/2020"
      6 
      7 if __name__ == "__main__":
      8     answer = 1
      9     for i in range(1, 21):
     10         if answer % i > 0:
     11             for k in range(1, 21):
     12                 if (answer * k) % i == 0:
     13                     answer *= k
     14                     break
     15     print((
     16         "The smallest positive number that is evenly divisible by all "
     17         "of the numbers from 1 to 20 is %s" % answer
     18     ))