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

2-suhyun113 #9

Merged
merged 4 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion suhyun113/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
| ์ฐจ์‹œ | ๋‚ ์งœ | ๋ฌธ์ œ์œ ํ˜• | ๋งํฌ | ํ’€์ด |
|:----:|:---------:|:----:|:-----:|:----:|
| 1์ฐจ์‹œ | 2024.03.25 | ๊ทธ๋ฆฌ๋”” | [์ฒด์œก๋ณต](https://school.programmers.co.kr/learn/courses/30/lessons/42862) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/2) |
---
| 2์ฐจ์‹œ | 2024.03.29 | ์ˆ˜ํ•™ | [์†Œ์ˆ˜ & ํŒฐ๋ฆฐ๋“œ๋กฌ](https://www.acmicpc.net/problem/1747) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/9) |
22 changes: 22 additions & 0 deletions suhyun113/์ˆ˜ํ•™/2-suhyun113.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ํŒฐ๋ฆฐ๋“œ๋กฌ ์ˆ˜
def is_palindrome(num):
return str(num) == str(num)[::-1]

# ์†Œ์ˆ˜ ์ฐพ๊ธฐ
def is_prime_num(n):
if n < 2:
return False # 1์€ ์†Œ์ˆ˜๊ฐ€ ์•„๋‹˜
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True

N = int(input()) # ์–ด๋–ค ์ˆ˜ N
# output์€ N๋ณด๋‹ค ํฌ๊ฑฐ๋‚˜ ๊ฐ™์œผ๋ฏ€๋กœ N์œผ๋กœ ์ดˆ๊ธฐํ™”
result = N # ํ˜„์žฌ

while True: # N๋ณด๋‹ค ํฌ๊ฑฐ๋‚˜ ๊ฐ™์€ ์ˆ˜(ํ•ญ์ƒ)
if is_prime_num(result) and is_palindrome(result): # ์†Œ์ˆ˜์ด๋ฉด์„œ ํŒฐ๋ฆฐ๋“œ๋กฌ์ธ ์ˆ˜
print(result)
break
result += 1