Factovisors
Time limit1sMemory limit128 MB
For each pair n and m, decide whether m divides n! by comparing the prime factors of m against those of n!.
- Level
Medium5 of 10
- Topics
- Number theory, Math
- Solved
- No attempts yet
Problem
For a non-negative integer , the factorial function is defined as follows:
0! = 1
n! = n * (n-1)! (n > 0)
We say that divides if there exists an integer such that .
Given two non-negative integers and , determine whether divides .
Input
The input consists of several lines. Each line contains two non-negative integers and , separated by a space, both less than . Input continues until the end of the file (EOF).
Output
For each input line, print m divides n! if divides , and m does not divide n! otherwise, on its own line. Replace m and n with the actual values from the input.