#P8219. Maximum Proper Divisor

    ID: 21398 Type: Default 1000ms 256MiB

Maximum Proper Divisor

Maximum Proper Divisor

Given a function \(f(x)\) which is defined as the greatest divisor of \(x\) other than \(x\) itself (where \(x\) is an integer greater than 1), your task is to find the maximum value of \(f(x)\) for every \(x\) in the range \([L,R]\) (inclusive).

For example:

  • \(f(8)=4\) because the divisors of 8 are \(1,2,4,8\) and the largest proper divisor is 4.
  • \(f(15)=5\) because the divisors of 15 are \(1,3,5,15\) and the largest proper divisor is 5.

You only need to output the maximum \(f(x)\) among all \(x\) in the interval \([L,R]\). The remaining operations are handled by Elgo87.

inputFormat

The input contains two space-separated integers \(L\) and \(R\) \( (L \le R) \), representing the inclusive range within which you must evaluate \(f(x)\).

outputFormat

Output a single integer which is the maximum \(f(x)\) for all \(x\) between \(L\) and \(R\), inclusive.

sample

8 15
7