python递归求解正整数的因式分解(约数)

approximate_input=input()
def approximateList(approximate_input,list=[]):
    approximate_prime_list=primeList(approximate_input)
    # print "approximate_List:",approximate_prime_list
    for i in reversed(approximate_prime_list):
        if approximate_input%i==0:
            list.append(i)
            approximate_input = approximate_input/i
            break
    if approximate_input==1:
        return list
    return approximateList(approximate_input,list)
approximate_list=approximateList(approximate_input)
print approximate_list

  

你可能感兴趣的:(python递归求解正整数的因式分解(约数))