Created
April 18, 2019 13:10
-
-
Save gegen07/e62ce58b8820d02d11684274434be1f5 to your computer and use it in GitHub Desktop.
Get all div of a number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fator = 2 | |
n = int(input()) | |
vetor = [] | |
aux = [] | |
while n > 1: | |
while n % fator == 0: | |
n /= fator | |
if len(vetor) > 0: | |
for i in vetor: | |
if (fator*i) not in vetor: | |
aux.append(fator*i) | |
vetor.extend(aux) | |
aux = [] | |
else: | |
vetor.append(fator) | |
fator += 1 | |
vetor.sort() | |
print(vetor) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment