Problem 3
2024-08-31 09:41:33
Problem 3
# Problem_3.py
"""
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
600851475143的最大质因数
"""
from math import sqrt num = 600851475143
size = int(sqrt(num)) + 1 is_prime = [True for i in range(size)] for i in range(2, size):
if is_prime[i]:
j = 2
while i * j < size:
is_prime[i * j] = False
j += 1 for i in range(size - 1, 1, -1):
if is_prime[i] and num % i == 0:
print(i)
break
最新文章
- iOS 真机测试 App installation failed
- SOA架构设计(转发)
- C语言实现的Web服务器(转-kungstriving)
- iOS OC内联函数 inline的详解
- 【Android 基础】Android中全屏或者取消标题栏
- ZOJ 3157 Weapon
- vs 折叠跟展开所有方法。
- (一)问候Struts2
- [Design Pattern] Command Pattern 命令模式
- c语言‘\0’ ,‘0’, “0” ,0之间的区别
- Thrift搭建分布式微服务1
- CSS(四)float 定位
- mysql的学习笔记(六)
- 【18】如何把数据存储到MongoDB数据库
- TC命令流量控制测试(针对具体IP地址和IP协议)
- 最短路 CF954D Fight Against Traffic
- ant.design初探
- Optimizing subroutine calls based on architecture level of called subroutine
- 创建Podspec 并且发布到github spec
- 性能强劲的Tokyo Cabinet 和 Tokyo Tyrant