Greatest Greatest Common Divisor
InterviewTime limit1sMemory limit1024 MB
Given L and R with R - L at most 10^6, find two distinct integers in [L, R] whose greatest common divisor is as large as possible.
- Level
Medium5 of 10
- Topics
- Number theory, Brute force, Math
- Solved
- No attempts yet
Statement
Everyone has met problems with a lazy statement. This problem is no exception.
Find a pair of distinct integers with the largest greatest common divisor among all pairs of distinct such that .
Input
Two integers and are given .
Output
Print a pair of distinct integers with the largest greatest common divisor. If there are several such pairs, print any of them.