Can you explain the algorithm of this code. This code finds prime divisors of a number.
def simpleDividers (n):
answer = []
d = 2
while d * d & lt; = n:
if n% d == 0:
answer.append (d)
n // = d
else:
d + = 1
if n & gt; 1:
answer.append (n)
return answer
Answer 1, authority 100%
def simpleDividers (n):
answer = [] # empty list
d = 2 # initial value of the checked divisor
while d * d & lt; = n: # check divisors to the root of n
if n% d == 0: # if modulo = 0
answer.append (d) # then add to the answer
n // = d # divide n by d
else:
d + = 1 # check the next divisor
if n & gt; 1: # if eventually n & gt; 1
answer.append (n) # add this n to the answer
return answer # return