Skip to content

Instantly share code, notes, and snippets.

@Ending2015a
Created April 16, 2019 02:49
Show Gist options
  • Save Ending2015a/aa6ccb6ed4426514c659727d73d48ac0 to your computer and use it in GitHub Desktop.
Save Ending2015a/aa6ccb6ed4426514c659727d73d48ac0 to your computer and use it in GitHub Desktop.
one line prime factorization in python
f = lambda x, j: [j] + f(x/j,j) if x%j==0 else f(x,j+1) if j<x else []
print(*f(int(input()), 2), sep='x')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment