The question is :
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
You may have a try first!
the answer:
For this problem ,you can find some condtion:
1.if it is not even number,then you need not to check even numbers.
2.the factor can start with floor(sqrt(evil_big_number))
3.if it is not a factor then you need not to check prime.
use these candition you can get the result soon.
my soluation:
def isPrime(num):
x = 2
while x < num :
if num %x == 0:
return 0
x = x + 1
return 1
from math import sqrt,floor
def findBiggerPrimeFactor(num):
factor = floor(sqrt(num))
while factor > 1 :
if factor % 2 != 0 and num % factor == 0 and isPrime(factor )== 1:
return factor
a = a -1
分享到:
相关推荐
标题 "three_class_problem.zip" 涉及的是一个使用Keras构建的三分类问题,这意味着我们需要将数据分为三个不同的类别。Keras是一个高级神经网络API,它建立在TensorFlow等后端之上,使得深度学习模型的开发变得简单...
Problem_C_Data.zip The three data sets provided contain product user ratings and reviews extracted from the Amazon Customer Reviews Dataset thru Amazon Simple Storage Service (Amazon S3). hair_dryer....
Three previous editions have established this text as a defining multidisciplinary treatment of the scientific principles that underpin the use of geographic information technologies for problem ...
1 Computers and Programs 1 1.1 The Universal Machine . . . . . . . . ....1.2 Program Power .... ....1.4 Hardware Basics ....1.5 Programming Languages ....1.6 The Magic of Python ....1.7 Inside a Python Program ....
and Fire [ three dragons are raised by Daenerys Targaryen, the “Mother of Dragons When hatched, the dragons are small, roughly 10 kg, and after a year grow to roughly 30 40 kg. They continue to grow...
用matlab对天体的三体运动的仿真模拟
标题中的“krishnanraman.github.io”是一个个人或项目的GitHub Pages网站,它展示了使用jstats、Scala.js和Three.js的JavaScript实验。其中,“mcmcnknapsack.html”可能是其中一个示例项目,可能涉及了背包问题...
1.Figure how to solve the problem. A.in B.off C.away D.out 答案D 2.His father is the British_____ to Japan. A.ambassador B.ambulance C.ambition D.embarrass 答案A 3.You must keep your eyes ________. ...
本文题为《非线性奇异三阶三点边值问题的正解》,研究了在数学领域特别是偏微分方程分支中,非线性奇异三阶三点边值问题(Singular Third-order Three-point Boundary Value Problem)的正解存在性问题。在这类问题...
### 三相感应电机问题分析 #### 概述 本文档详细介绍如何利用Ansoft RMxprt 软件建立、求解并分析一个两极三相感应电机模型,并进一步使用EMpulse进行更深入的分析以提高性能预测的准确性。RMxprt通过结合解析法和...
3.2 Collective Classification: Notation and Problem Definition . . 53 3.3 Approximate Inference Algorithms for Approaches Based on Local Conditional Classifiers . . . . . . . . . . . . . . . . . . . ...
1 Getting Started . . . . . . . . . ....1.1 A Brief Introduction to C++ ....1.1.1 C++ is “Object-Oriented” ....1.1.2 Why You Should Write Scientific Programs in C++ ....1.1.4 Scope of This Book ....
三体问题——从牛顿到超级计算机加机器学习_Three-body problem -- from Newton to supercomputer plus machine learning.pdf
-p5.js-Presentation_of_Three-body_Problem 【p5.js】三体模型演示