#P8084. [COCI 2011/2012 #4] BROJ
[COCI 2011/2012 #4] BROJ
Problem Description
Find the -th smallest positive integer not exceeding whose smallest prime factor is .
Input Format
The first line contains two integers . It is guaranteed that is a prime number.
Output Format
Output the required -th smallest positive integer not exceeding . If the answer exceeds , output .
1 2
2
2 3
9
1000 1000003
0
Hint
【Constraints and Notes】
- For of the testdata, the output is less than (including ).
- For another of the testdata, .
- For of the testdata, .
【Hints and Explanation】
This problem is translated from COCI 2011-2012 CONTEST #4 Task 5 BROJ.
The score of this problem follows the original COCI setting, with a full score of .
Translated by ChatGPT 5