예제 #1
0
파일: test026.py 프로젝트: jramaswami/euler
 def test_lambda_decimal_period(self):
     """Test lambda_decimal_period()"""
     print("Testing lambda calcs ...")
     data = p26.read_period_table()
     for index in tqdm.trange(1, 5000):
         period = p26.lambda_decimal_period(index)
         msg = "%d != %d for %d" % (period, data[index], index)
         self.assertEquals(data[index], period, msg)
예제 #2
0
파일: test026.py 프로젝트: jramaswami/euler
    def x_test_calculate_period(self):
        """
        Test calculate_period() using table of length of the
        period of decimal representation.

        See http://oeis.org/A051626
        """
        data = p26.read_period_table()
        for index in tqdm.trange(1, 1000):
            period = p26.calculate_period_length(index)
            msg = "%d != %d for %d" % (period, data[index], index)
            self.assertEquals(data[index], period, msg)