progs/factors.while
author Christian Urban <urbanc@in.tum.de>
Wed, 16 Oct 2019 11:14:53 +0100
changeset 659 15b69ca63b29
parent 658 a18e3c027c1f
permissions -rw-r--r--
optional

// 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
}