UVa 10139 - Factovisors

10139 - Factovisors

 * http://acm.uva.es/p/v101/10139.html

Summary
Summary of the problem statement goes here.

Explanation
1) Simply any number can be represented as product of primes to powers $$x = p_1^{a_1} * p_2^{a_2} * p_3^{a_3} \ldots p_m^{a_m} \ldots$$

2) $$b | a \iff a = kb$$

So now only reprsent the second number (which will divide the factorail) and see if the powers of its prime less than the powers in the factorial.

For example assume we need to know if 12 divides 6! or not.

1) Start for representing 12 as $$12 = 2^2 * 3^1$$ Now call some function to tell you What is the power of a prime in factorial n;

int get_powers(n, p).

now calling once for 2 we get that 6! has 2^4 Where 4 is great than 2 (2^2 < 2^4)

now calling once for 3 we get that 6! has 3^2 Where 2 is great than 1 (3^1 < 3^2)

After finishing all the powers of 12 without any problems --> 12 divides 6!

Gotchas

 * Any points one can easily overlook?
 * The correct way to understand ambiguous formulations?

Input
Input Here

Output
Output Here