시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB89542527645.923%

문제

정수 K (1 ≤ K ≤ 100,000)가 주어진다. 이때, K보다 크거나 같은 서로 다른 소수의 곱 중에서 가장 작은 곱을 찾는 프로그램을 작성하시오.

입력

첫째 줄에 테스트 케이스의 개수 T (1 ≤ T ≤ 20)이 주어진다. 다음 T개 줄에는 K가 한 줄에 하나씩 주어진다.

출력

각각의 K마다 K보다 크거나 같은 서로 다른 두 소수의 곱 중에서 가장 작은 곱을 출력한다.

예제 입력 1

5
1
3
10
300
100000

예제 출력 1

6
6
10
301
100001

힌트

K=1인 경우 답은 6 = 2 × 3이다. 6은 서로 다른 두 소수의 곱 중에서 가장 작은 곱이다. 4 = 2 × 2 이기 때문에, 정답이 되지 않는다.

세 번째 예제 K=10인 경우에 정답은 10 = 2 × 5 이다.

마지막 예제 K=100000인 경우 정답은 100001 = 11 × 9091 이다.

W3sicHJvYmxlbV9pZCI6Ijk3NTMiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM5ZGQgXHVhY2YxIiwiZGVzY3JpcHRpb24iOiI8cD5cdWM4MTVcdWMyMTggSyAoMSAmbGU7IEsgJmxlOyAxMDAsMDAwKVx1YWMwMCBcdWM4ZmNcdWM1YjRcdWM5YzRcdWIyZTQuIFx1Yzc3NFx1YjU0YywgS1x1YmNmNFx1YjJlNCBcdWQwNmNcdWFjNzBcdWIwOTggXHVhYzE5XHVjNzQwIFx1YzExY1x1Yjg1YyBcdWIyZTRcdWI5NzggXHVjMThjXHVjMjE4XHVjNzU4IFx1YWNmMSBcdWM5MTFcdWM1ZDBcdWMxMWMgXHVhYzAwXHVjN2E1IFx1Yzc5MVx1Yzc0MCBcdWFjZjFcdWM3NDQgXHVjYzNlXHViMjk0IFx1ZDUwNFx1Yjg1Y1x1YWRmOFx1YjdhOFx1Yzc0NCBcdWM3OTFcdWMxMzFcdWQ1NThcdWMyZGNcdWM2MjQuPFwvcD5cclxuIiwiaW5w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ZCAyIGFuZCA1IGFyZSBkaWZmZXJlbnQuPFwvcD5cclxuIiwib3JpZ2luYWwiOiIxIiwiaHRtbF90aXRsZSI6IjAiLCJwcm9ibGVtX2xhbmdfdGNvZGUiOiJFbmdsaXNoIn1d

출처

ICPC > Regionals > Asia Pacific > Thailand > Thailand Central Group-B Programming Contest > Thailand Central Group-B Programming Contest 2013 A번