Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#38 4948 베르트랑 공준 #38

Open
yongholeeme opened this issue Mar 31, 2019 · 0 comments
Open

#38 4948 베르트랑 공준 #38

yongholeeme opened this issue Mar 31, 2019 · 0 comments
Labels
6-7주차 19-1 19-1 Problem Solving

Comments

@yongholeeme
Copy link

Problem: 베르트랑 공준

베르트랑 공준은 임의의 자연수 n에 대하여, n보다 크고, 2n보다 작거나 같은 소수는 적어도 하나 존재한다는 내용을 담고 있다.

이 명제는 조제프 베르트랑이 1845년에 추측했고, 파프누티 체비쇼프가 1850년에 증명했다.

예를 들어, 10보다 크고, 20보다 작거나 같은 소수는 4개가 있다. (11, 13, 17, 19) 또, 14보다 크고, 28보다 작거나 같은 소수는 3개가 있다. (17,19, 23)

n이 주어졌을 때, n보다 크고, 2n보다 작거나 같은 소수의 개수를 구하는 프로그램을 작성하시오.

입력 설명

입력은 여러 개의 테스트 케이스로 이루어져 있다. 각 케이스는 n을 포함하며, 한 줄로 이루어져 있다. (n ≤ 123456)

입력의 마지막에는 0이 주어진다.

출력 설명

각 테스트 케이스에 대해서, n보다 크고, 2n보다 작거나 같은 소수의 개수를 출력한다.

입력 및 출력 예제

# 예제 입력1
1
10
13
100
1000
10000
100000
0

# 예제 출력1
1
4
3
21
135
1033
8392

언어제한

  • C/C++
  • Python3

문제 출처

https://www.acmicpc.net/problem/4948

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6-7주차 19-1 19-1 Problem Solving
Projects
None yet
Development

No branches or pull requests

1 participant