Is there a command-line program for Linux that prints out a factor tree? Submitted by elyersio on January 11, 2018 at 5:41 AM in Math I can't find a function that prints out a list of factors in calc. My homework is simplifying radicals, which requires factoring. 3 comments 6
Cosine wrote on January 14, 2018 at 12:09 AM Believe it or not, GNU coreutils includes the factor program $ factor 112 112: 2 2 2 2 7 Permalink 4
zombie_berkman wrote on January 11, 2018 at 4:42 PM I beleieve I used BC to do this in college but I forget how I did it. Sorry Permalink 2
registrant wrote on November 7, 2019 at 5:50 PM In perl 6: sub factor(Int $i){ if $i == 2 { say 2; return; } if $i == 3 { say 3; return; } return if $i == 1; for 2..$i.sqrt { if $i %% $_ { #found a factor say $_; factor Int($i/$_); return; } } say $i; } Permalink 1
Cosine wrote
Believe it or not, GNU coreutils includes the
factor
program