Number with the Most Divisors
Time limit1sMemory limit1024 MB
Given n up to 3,000,000, find the smallest number in 1..n with the most positive divisors, and report that divisor count.
- Level
Medium4 of 10
- Topics
- Number theory, Math, Brute force, Implementation
- Solved
- No attempts yet
Problem
A number is given.
Write a program numdiv that finds a number between and inclusive that has the largest number of positive integer divisors.
Input
The first line of standard input contains a single integer .
Output
The first line of standard output must contain the number with the largest number of divisors.
The second line must contain the number of divisors of that number.
If several numbers between and have the largest number of divisors, output the smallest of them.
Constraints
Hint
Explanation of sample 2: The number has divisors: . The number also has divisors: . But is the smaller of the two.