Problem BN
Prime Reduction
A prime number
Consider the following process, which we’ll call prime
reduction. Given an input
-
if
is prime, print and stop -
factor
into its prime factors -
let
-
go back to step 1
Write a program that implements prime reduction.
Input
Input consists of a sequence of up to
Output
For each integer, print the value produced by prime reduction executed on that input, followed by the number of times the first line of the process executed.
Sample Input 1 | Sample Output 1 |
---|---|
2 3 5 76 100 2001 4 |
2 1 3 1 5 1 23 2 5 5 5 6 |