Ad
Code
Diff
  • def reverse_fact(input):
        start = 1
        while input % start == 0: 
            input /= start
            if input == 1: return start
            start += 1
        return 0
    • def reverse_fact(input):
    • start = 1
    • while input % start == 0:
    • input /= start
    • print(input)
    • if input == 1: return start
    • start += 1
    • return 0
Code
Diff
  • def reverse_fact(input):
        start = 1
        while input != 1: 
            start += 1
            if input % start != 0 :
                return 0
            input /= start
            print(input)
        return start
    • def reverse_fact(input):
    • prod = 1
    • i = 1
    • while True:
    • if input % i == 0:
    • prod *= i
    • if prod == input:
    • return i
    • else:
    • start = 1
    • while input != 1:
    • start += 1
    • if input % start != 0 :
    • return 0
    • i += 1
    • input /= start
    • print(input)
    • return start