7f8baa2d63
Signed-off-by: Christina Sørensen <christina@cafkafk.com>
8 lines
253 B
Text
8 lines
253 B
Text
def primefactors:
|
|
if .value <= 1 then empty
|
|
elif .value < .factor * .factor then .value
|
|
elif .value % .factor > 0 then .factor += 1 | primefactors
|
|
else .factor, ((.value = .value / .factor) | primefactors)
|
|
end;
|
|
|
|
[ .factor = 2 | primefactors ]
|