def find_solution(self):
        """
        This method contains the guts of finding the solution.
        The timer starts just prior to calling this method
        and stops just after returning the solution's value.
        """

        up_to = 0
        delta = 5000
        while len(Arithmetic.PRIMES_LIST) < 10002:
            up_to += delta
            Arithmetic.primes_up_to(up_to)

        return Arithmetic.PRIMES_LIST[10000]
 def find_solution(self):
     """
     This method contains the guts of finding the solution.
     The timer starts just prior to calling this method
     and stops just after returning the solution's value.
     """
     
     up_to = 0
     delta = 50000
     while up_to < 2000000:
         up_to += delta
         Arithmetic.primes_up_to(up_to)
     
     p_list = Arithmetic.primes_up_to(2000000)
     return "%d" % np.sum(p_list)
 def test_set_position(self):
     
     values = Arithmetic.primes_up_to(2)
     msg = 'Primes through 2'
     exp = np.array([2])
     self.assertListEqual(list(exp), list(values), msg)
     
     values = Arithmetic.primes_up_to(6)
     msg = 'Primes through 6'
     exp = np.array([2, 3, 5])
     self.assertListEqual(list(exp), list(values), msg)
     
     values = Arithmetic.primes_up_to(20)
     msg = 'Primes through 6'
     exp = np.array([2, 3, 5, 7, 11, 13, 17, 19])
     self.assertListEqual(list(exp), list(values), msg)
 def find_solution(self):
     """
     This method contains the guts of finding the solution.
     The timer starts just prior to calling this method
     and stops just after returning the solution's value.
     """
     # Initialize the palindrome instance with a palindrome just
     # above the largest possible and walk backwards.
     #
     # 999 * 999 = 998001  so 998899 is too large
     p_value = 998899
     p_seq = Palindrome(p_value)
     
     p_list = Arithmetic.primes_up_to(1000)
     
     while p_value >= 10000:
         p_value = p_seq.previous()
         factors = np.array([])
         value = p_value
         for prime in p_list:
             # If the value is 1, we've got it all
             if value == 1:
                 break
             while value % prime == 0:
                 # this prime is a factor of value so pull it out
                 factors = np.append(factors, prime)
                 value = value / prime
         if value != 1:
             # If the value is not 1 by now, a larger than 3 digit
             # prime factor exists so this is not a solution.
             continue
         
         # Try to construct two 3-digit factors.  Start at the highest
         # prime factor, and multiply it in to the lowest of the two 
         # factors as you go trying to keep them even so both end up
         # under the 1000 mark.
         factor_1 = 1
         factor_2 = 1
         for index in range(len(factors), 0, -1):
             factor = factors[index-1]
             if factor_1 <= factor_2:
                 factor_1 *= factor
             else:
                 factor_2 *= factor
         if factor_1 < 1000 and factor_2 < 1000:
             break
     
     return '%d x %d = %d' % (factor_1, factor_2, factor_1 * factor_2)