Quick actions

cmd+k|ctrl+k

Navigation

Languages

factorso(sqrt(n))

Snippet info

Language

Python

Visibility

public

Author

moin778866.ma

Created

2022-08-27T19:22:20.424995Z

Updated

2022-08-27T19:22:20.424995Z

import math
def factor(n):
    i = 1
    lst = []
    # for i in range(1,math.sqrt(n+1)):
    while i < math.sqrt(n+1):
        if n%i == 0:
           lst.append(i)
           lst.append(int(n/i))
        i +=1
    lst.sort()
    return lst

print(factor(20))
        
INFO