Skip to content

Instantly share code, notes, and snippets.

@wiccy46
Created April 17, 2020 20:40
Show Gist options
  • Save wiccy46/61e1f5087581bc9bb8c001435b1a687c to your computer and use it in GitHub Desktop.
Save wiccy46/61e1f5087581bc9bb8c001435b1a687c to your computer and use it in GitHub Desktop.
[divisors] Find all divisors of a number, inkl 1 and self. #python #math
def get_divisors(n):
return set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment