Problem1 | |
原题: | 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。 |
分析: | 求出1000(不包括1000)以下3或5倍数的和。 可以直接循环求,也可以用抽屉原理及等差数列求和公式来。 |
代码: |
|
Problem2 | |
原题: | 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, ... Find the sum of all the even-valued terms in the sequence which do not exceed four million. |
分析: | 求出Fibonacci数列中,小于4000000且为偶数的和 慢慢来呗! |
代码: |
|
Problem3 | |
原题: | The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? |
分析: | 就是求600851475143最大质因数。 |
代码: |
|
Problem4 | |
原题: | A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 Find the largest palindrome made from the product of two 3-digit numbers |
分析: | palindromic number:回文数 题目求的是两个三位数积中最大的回文数,邪恶的暴力。 |
代码: |
|
Problem5 | |
原题: |
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 number that is evenly divisible by all of the numbers from 1 to 20? |
分析: | 其实题目求的就是1~20的最小公倍数。 由于数字比较小,且这个数必须是1~20中所有质数的公倍数,所以暴力吧! |
代码: |
|
Problem6 | |
原题: | The sum of the squares of the first ten natural numbers is, Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 - 385 = 2640. Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum. |
分析: | 求的是:1到100的平方和减去1到100和的平方的差 |
代码: |
|
Problem7 | |
原题: | 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 10001st prime number? |
分析: | 求第10001个质数 |
代码: |
|
Problem8 | |
原题: | Find the greatest product of five consecutive digits in the 1000-digit number. 73167176531330624919225119674426574742355349194934 |
分析: | 在上面1000个数字中,求出最大连续5个数的积 |
代码: |
|
Problem9 | |
原题: | A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2. There exists exactly one Pythagorean triplet for which a + b + c = 1000. |
分析: | 求满足以下条件三个整数的积: 1,构成勾股数;2,和为1000. 无耻地暴力吧 |
代码: |
|
Problem10 | |
原题: | The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. |
分析: | 求2百万以下质数的和 |
代码: |
|