Peter is working on a combinatorial problem. He has carried out quite lengthy derivations and got a resulting formula that is a ratio of two products of factorials like this:
This does not surprise Peter, since factorials appear quite often in various combinatorial formulae, because n! represents the number of transpositions of n elements — one of the basic combinatorial objects.
However, Peter might have made a mistake in his derivations. He knows that the result should be an integer number and he needs to check this first. For an integer result Peter wants to simplify this formula to get a better feeling of its actual combinatorial significance. He wants to represent the same number as a product of factorials like this.
where all ri
are distinct integer numbers greater than one in the descending order (ri
> 1), si
and t are positive integers. Among all the possible representations in this form, Peter is interested in one where r1
is the largest possible number, among those in the one where s1
is the largest possible number; among those in the one where r2
is the largest possible number; among those in the one where s2
is the largest possible number; etc, until the remaining t cannot be further represented in this form. Peter does not care about the actual value of t. He wants to know what is the factorial-product part of his result.