Prime Factors

Find all prime factors of a number using trial division.

Code

Algorithms
factor "$n" | cut -d: -f2 | tr ' ' '\n' | grep -v '^$' | jq -Rs 'split("\n") | map(select(. != "") | tonumber)'

Parameters

Number to factorize

Server

More Bash Snippets