Divide and Conquer
Time limit1sMemory limit128 MB
Among integers from M to N, pick the one with the most divisors, breaking ties by the largest value, and report it with its divisor count.
- Level
Easy3 of 10
- Topics
- Number theory, Brute force, Implementation, Math
- Solved
- No attempts yet
Problem
You are given two integers and with . Determine two integers and that satisfy all of the following:
- A. ;
- B. is the number of divisors of ;
- C. is as large as possible;
- D. is as large as possible.
In other words, among all integers in the range , choose the one with the greatest number of divisors as ; if several integers tie for the greatest number of divisors, choose the largest such integer. is that number of divisors.
Input
The input consists of several test cases. Each test case is a single line containing two integers and () separated by a space. A line with marks the end of the input and should not be processed.
The input is read from standard input.
Output
For each test case, print a single line containing the two integers and separated by a space.
The output is written to standard output.