def ppdp(n): for d in range(2,n+1): if n%d==0: return d def decomposer(n): while n!=1: d=ppdp(n) print(d) n=n//d