Answers for "fastest way to find factors of a number python"

1

python find the factors of a number

def findFactors(num: int)->list:
  factors=[]
  for i in range(1,num+1):
     if num%i==0:
         factors.append(i)
  return factors
Posted by: Guest on April-15-2021
1

python find factors of a number

def factors(n):
    return set(reduce(list.__add__, 
        ([i, n//i] for i in range(1, int(n**0.5) + 1) if not n % i )))
Posted by: Guest on October-20-2020

Code answers related to "fastest way to find factors of a number python"

Python Answers by Framework

Browse Popular Code Answers by Language