Example #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
Example #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
Example #3
0
def is_prime(number):
    if number == 2:
        return True

    if number %2 == 0 or number < 2:
        return False

    factor = 3
    while factor*factor <= number:
        if Factors.isFactor(number, factor):
            return False
        factor += 1

    return True
Example #4
0
def divisbleByAll(number):
    for i in range(1,20):
        if(not Factors.isFactor(number, i)):
            return False

    return True
Example #5
0
def divisbleByAll(number):
    for i in range(1, 20):
        if (not Factors.isFactor(number, i)):
            return False

    return True
Example #6
0
 def test_isFactorShouldReturnFalse(self):
     self.assertEqual(Factors.isFactor(14,3), False)
Example #7
0
 def test_isFactorShouldReturnTrue(self):
     self.assertEqual(Factors.isFactor(12,3), True)
Example #8
0
 def test_SmallestFactorOfShouldReturn3(self):
     self.assertEqual(Factors.smallestFactorOf(21), 3)
Example #9
0
 def test_SmallestFactorOfShouldReturn2(self):
     self.assertEqual(Factors.smallestFactorOf(24), 2)