#B2138. Largest Prime Factor in Range

    ID: 11220 Type: Default 1000ms 256MiB

Largest Prime Factor in Range

Largest Prime Factor in Range

Given two positive integers \(m\) and \(n\) such that \(2 \le m \le n \le 5000\), for each integer \(x\) with \(m \le x \le n\), output the largest prime factor of \(x\). Note that if \(x\) itself is prime, then output \(x\) itself.

inputFormat

The input consists of two space-separated integers \(m\) and \(n\). It is guaranteed that \(2 \le m \le n \le 5000\).

outputFormat

For each integer \(x\) from \(m\) to \(n\) (inclusive), print its largest prime factor on a separate line.

sample

2 10
2

3 2 5 3 7 2 3 5

</p>