I've seen many ways of doing integer factorizations in Python, but didn't really understand them, so I tried to do it on my own way: def factorisation(n): fact = [] i = 2 while i <= n: if n % i == 0: fact.append(i) n //= i else: i += 1 return fact I think it is working, but I don't really know why the while loop from i to n... From my lesson I learnt that we have to do it from 2 to sqrt(n). Did I misunderstand something? Can I improve it? Continue reading...