1.13 编程基础之综合应用 05 素数回文数的个数 python
生活随笔
收集整理的這篇文章主要介紹了
1.13 编程基础之综合应用 05 素数回文数的个数 python
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
http://noi.openjudge.cn/ch0113/05/
""" 1.13 編程基礎之綜合應用 05 素數回文數的個數 http://noi.openjudge.cn/ch0113/05/找出一個區間內所有回文素數的個數(python) https://blog.csdn.net/sinat_32512123/article/details/102632959 https://www.freesion.com/article/3231159170/ https://www.jb51.net/article/174931.htm利用python判斷一個數是不是回文素數 https://www.it610.com/article/1292864539787862016.htm【作業】Python - 計算2-100之間素數的個數,返回結果(進階版) https://www.cnblogs.com/cxstudy/p/11984023.html"""n=int(input())def ishuiwen(number):length = len(str(number))list = [int(x) for x in str(number)]for j in range(length // 2):if list[j] != list[length - 1 - j]:return Falsereturn Truedef issushu(number):if number>1:for j in range(2, number):if number % j == 0:return Falsereturn Truenum = 0 for number in range(11, n+1): if issushu(number) and ishuiwen(number):num = num + 1print(num)參考:
找出一個區間內所有回文素數的個數(python)
https://blog.csdn.net/sinat_32512123/article/details/102632959
https://www.freesion.com/article/3231159170/
https://www.jb51.net/article/174931.htm
利用python判斷一個數是不是回文素數
https://www.it610.com/article/1292864539787862016.htm
【作業】Python - 計算2-100之間素數的個數,返回結果(進階版)
https://www.cnblogs.com/cxstudy/p/11984023.html
總結
以上是生活随笔為你收集整理的1.13 编程基础之综合应用 05 素数回文数的个数 python的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 第51课 拍手游戏--2021.09.1
- 下一篇: python刷题相关资料汇总(一)