Article 6PX5Q help factor calculation in bash?

help factor calculation in bash?

by
blumenwesen
from LinuxQuestions.org on (#6PX5Q)
hello, I have tried the factors with a comprehensible calculation method without "factor..." to calculate, the loop still works with 55 = 5 11 but at 120 = 30 4.
i have lost track, can someone help me further?

Code:z=120; y=$z; x=$z;
until (( $[y--] < 3 )); do
until (( $x <= $y || $[$x/$y] <= $y || $[(${x}0/$y)%10] != 0 )); do
x=$[$x/$y];
echo $x $y $[$x/$y]
done; done;
echo -e "\n"$[$z/$x] $x" \n"
factor 120 # correct result = 120: 2 2 2 3 5
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments