now we have to iterate only for integers who does not have prime factor 2 and 3
for i in range ( 5 , int ( math . sqrt ( n ) ) + 1 , 6 ) : NEW_LINE INDENT while n % i == 0 : NEW_LINE INDENT maxPrime = i NEW_LINE n = n / i NEW_LINE DEDENT while n % ( i + 2 ) == 0 : NEW_LINE INDENT maxPrime = i + 2 NEW_LINE n = n / ( i + 2 ) NEW_LINE DEDENT DEDENT