
算法
kuaileyezi
这个作者很懒,什么都没留下…
展开
-
No.1 The sum of all the multiples of 3 or 5 below 1000
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.Find the sum of all the multiples of 3 or 5 below 1000.A:#! /...原创 2012-08-20 13:53:11 · 163 阅读 · 0 评论 -
No.2 Sum of the even-valued terms in the Fibonacci
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...By considering...原创 2012-08-20 13:53:41 · 156 阅读 · 0 评论 -
No.3 The largest prime factor of number
Q: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ?################################# shell ## echo 60085...原创 2012-08-20 13:55:55 · 235 阅读 · 0 评论 -
No.4 The largest palindrome made from the product of two 3-digit numbers
Q:A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.Find the largest palindrome made from the product of two 3-di...原创 2012-08-20 17:06:52 · 215 阅读 · 0 评论 -
No.5 The smallest positive number
Q:2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.What is the smallest positive number that is evenly divisible by all of the numbers fr...原创 2012-08-21 09:40:51 · 213 阅读 · 0 评论 -
No.6 The difference between the sum of the squares and the square of the sum
Q:The sum of the squares of the first ten natural numbers is,1^2 + 2^2 + ... + 10^2 = 385The square of the sum of the first ten natural numbers is,(1 + 2 + ... + 10)^2 = 552 = 3025Hence ...原创 2012-08-22 09:52:33 · 344 阅读 · 0 评论 -
No.7 The 10001st prime number
Q:By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.What is the 10 001st prime number?A:import mathimport timet1 = time.time()de...原创 2012-08-23 16:16:15 · 161 阅读 · 0 评论 -
No.8 The greatest product of five consecutive digits in the 1000-digit numb
Q:Find the greatest product of five consecutive digits in the 1000-digit number.73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078...原创 2012-08-23 17:27:34 · 128 阅读 · 0 评论 -
No.9 Find the product abc
Q:A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,a2 + b2 = c2For example, 32 + 42 = 9 + 16 = 25 = 52.There exists exactly one Pythagorean triplet for which a +...原创 2012-08-27 10:19:39 · 192 阅读 · 0 评论