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

Problem 3的更多相关文章

  1. 1199 Problem B: 大小关系

    求有限集传递闭包的 Floyd Warshall 算法(矩阵实现) 其实就三重循环.zzuoj 1199 题 链接 http://acm.zzu.edu.cn:8000/problem.php?id= ...

  2. No-args constructor for class X does not exist. Register an InstanceCreator with Gson for this type to fix this problem.

    Gson解析JSON字符串时出现了下面的错误: No-args constructor for class X does not exist. Register an InstanceCreator ...

  3. C - NP-Hard Problem(二分图判定-染色法)

    C - NP-Hard Problem Crawling in process... Crawling failed Time Limit:2000MS     Memory Limit:262144 ...

  4. Time Consume Problem

    I joined the NodeJS online Course three weeks ago, but now I'm late about 2 weeks. I pay the codesch ...

  5. Programming Contest Problem Types

        Programming Contest Problem Types Hal Burch conducted an analysis over spring break of 1999 and ...

  6. hdu1032 Train Problem II (卡特兰数)

    题意: 给你一个数n,表示有n辆火车,编号从1到n,入站,问你有多少种出站的可能.    (题于文末) 知识点: ps:百度百科的卡特兰数讲的不错,注意看其参考的博客. 卡特兰数(Catalan):前 ...

  7. BZOJ2301: [HAOI2011]Problem b[莫比乌斯反演 容斥原理]【学习笔记】

    2301: [HAOI2011]Problem b Time Limit: 50 Sec  Memory Limit: 256 MBSubmit: 4032  Solved: 1817[Submit] ...

  8. [LeetCode] Water and Jug Problem 水罐问题

    You are given two jugs with capacities x and y litres. There is an infinite amount of water supply a ...

  9. [LeetCode] The Skyline Problem 天际线问题

    A city's skyline is the outer contour of the silhouette formed by all the buildings in that city whe ...

  10. PHP curl报错“Problem (2) in the Chunked-Encoded data”解决方案

    $s = curl_init(); curl_setopt($s, CURLOPT_POST, true); curl_setopt($s, CURLOPT_POSTFIELDS, $queryStr ...

随机推荐

  1. Git .gitignore文件忽略

    Git .gitignore文件忽略 学习了:http://blog.csdn.net/yonnangel/article/details/50115059 http://www.cnblogs.co ...

  2. 【SQLSERVER】MD5注意事项

    sql中使用MD5加密是很常见的事情,但是不知道注意点的人还是会即便是拷贝网络上的写法也是会出现错误的. 举个例子简单说明: 由上图我们可以发现相同的字符串但是得到的MD5加密的字符却是不相同的,那么 ...

  3. mac 下作流程图工具omnigraffle

    omnigraffle:http://www.uzzf.com/soft/91710.html 含盖激活码: Name: mojado Serial: JYFE-JRJN-GSOT-GRAG-EVJI ...

  4. 黑马day01 笔记

    一.xml语法   1.文档声明     用来声明xml的基本属性,用来指挥解析引擎怎样去解析当前xml     通常一个xml都要包括而且仅仅能包括一个文档声明     xml的文档必须在整个xml ...

  5. 在ubuntu中安装与配置zsh与oh-my-zsh

    先补充点东西 1.ubuntu中默认安装了那些shell jiang@Linux:~$ cat /etc/shells # /etc/shells: valid login shells/bin/sh ...

  6. 详解Google第二代TPU 既能推理又能训练 性能霸道

    详解Google第二代TPU 既能推理又能训练 性能霸道 转自:http://www.cnbeta.com/articles/tech/613639.htm 5月18日凌晨,Google CEO Su ...

  7. TCP心跳包

    所谓的心跳包就是客户端定时放送简单的信息给服务器端,告诉它我还在而已.代码就是每 隔几分钟发送一个固定信息给服务器端,服务器端回复一个固定信息.如果服务器端几分钟后没有收到客户端信息则视客户端断开.比 ...

  8. js中的面向对象(一)封装

    1.简单的封装(定义) var cat1 = {}; cat1.name = '阿黄'; cat1.sex = '男'; cat1.age = 11; //cat2也同样具有三个属性 var cat2 ...

  9. MongoDB Master-Slave cluster with authentication setup

    Master Server create mongo db folder with sub folders like data, conf, && log mkdir -p /opt/ ...

  10. jquery自动完成插件的使用

    .ui-autocomplete { z-index: !important; max-height: 100px; overflow-y: auto; /* 防止水平滚动条 */ overflow- ...