Esempio n. 1
0
def problem5():
    """ Smallest multiple
    2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any
    remainder. What is the smallest positive number that is evenly divisible by all of the numbers
    from 1 to 20?

    """
    return mathhelper.least_common_multiple(*range(1, 21))
Esempio n. 2
0
 def test_least_common_multiple(self):
     self.assertEqual(mathhelper.least_common_multiple(-1), -1)
     self.assertEqual(mathhelper.least_common_multiple(0), 0)
     self.assertEqual(mathhelper.least_common_multiple(-5, 10), -10)
     self.assertEqual(mathhelper.least_common_multiple(-5, 0), 0)
     self.assertEqual(mathhelper.least_common_multiple(5, 0), 0)
     self.assertEqual(mathhelper.least_common_multiple(-5, -1), 5)
     self.assertEqual(mathhelper.least_common_multiple(-5, 1), -5)
     self.assertEqual(mathhelper.least_common_multiple(8, 4), 8)
     self.assertEqual(mathhelper.least_common_multiple(13, 7), 91)
     self.assertEqual(mathhelper.least_common_multiple(-5, 10, 0), 0)
     self.assertEqual(mathhelper.least_common_multiple(1, 2, 4, 8, 16), 16)
     self.assertEqual(mathhelper.least_common_multiple(2, 4, 8, 16, 32), 32)