progs/factors.while
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Tue, 21 Jul 2020 00:12:34 +0100
changeset 737 14a348d050b3
parent 659 15b69ca63b29
permissions -rw-r--r--
updated

// Find all factors of a given input number
// by J.R. Cordy August 2005

write "Input n please";
read n;
write "The factors of n are";
f := 2;
while n != 1 do {
    while (n / f) * f == n do {
        write f;
        n := n / f
    };
    f := f + 1
}