Exemplo n.º 1
0
def solve():
    smallest_factor = Factors.smallestFactorOf(problemNumber)
    largest_factor = int(problemNumber/smallest_factor)

    for i in range(smallest_factor, largest_factor):
    
        if Factors.isFactor(problemNumber, i):
            counterpart = int(problemNumber/i)
    
            if Primes.is_prime(counterpart):
                return counterpart
Exemplo n.º 2
0
def solve():
    smallest_factor = Factors.smallestFactorOf(problemNumber)
    largest_factor = int(problemNumber / smallest_factor)

    for i in range(smallest_factor, largest_factor):

        if Factors.isFactor(problemNumber, i):
            counterpart = int(problemNumber / i)

            if Primes.is_prime(counterpart):
                return counterpart
Exemplo n.º 3
0
 def test_SmallestFactorOfShouldReturn3(self):
     self.assertEqual(Factors.smallestFactorOf(21), 3)
Exemplo n.º 4
0
 def test_SmallestFactorOfShouldReturn2(self):
     self.assertEqual(Factors.smallestFactorOf(24), 2)