摘要: The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two million. int[] numbers = Enumerable.Range(1, 2000000).ToArray(); int prime = 2; int nextPrime = 2; int nextPrimePow2 = 2 * 2; for (int i = 1; nextPrime... 阅读全文
posted @ 2011-08-28 17:33 kiminozo 阅读(360) 评论(0) 推荐(0) 编辑
摘要: 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 + b + c = 1000.Find the product abc. for (int b = 0; b < 500; b++) { for (int ... 阅读全文
posted @ 2011-08-28 17:32 kiminozo 阅读(319) 评论(0) 推荐(0) 编辑
摘要: Find the greatest product of five consecutive digits in the 1000-digit number. 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 12540698747158523863050715693290963295227443043557 66896648950445244 阅读全文
posted @ 2011-08-28 17:31 kiminozo 阅读(538) 评论(0) 推荐(0) 编辑
摘要: 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?class Program { private static List<long> primes = new List<long>(10000000); static void Main(string[] args) { primes.Add(2); ... 阅读全文
posted @ 2011-08-28 17:30 kiminozo 阅读(227) 评论(0) 推荐(0) 编辑
摘要: The sum of the squares of the first ten natural numbers is,12 + 22 + ... + 102 = 385The square of the sum of the first ten natural numbers is,(1 + 2 + ... + 10)2 = 552 = 3025Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 385 = . 阅读全文
posted @ 2011-08-28 17:28 kiminozo 阅读(276) 评论(0) 推荐(0) 编辑
摘要: 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 from 1 to 20?internal class Program { private static void Main(string[] args) { /*... 阅读全文
posted @ 2011-08-28 17:25 kiminozo 阅读(640) 评论(0) 推荐(0) 编辑
摘要: 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-digit numbers.class Program { static void Main(string[] args) { /* ... 阅读全文
posted @ 2011-08-28 17:24 kiminozo 阅读(338) 评论(0) 推荐(0) 编辑
摘要: The prime factors of 13195 are 5, 7, 13 and 29.What is the largest prime factor of the number 600851475143 ?class Program { private static List<long> primes = new List<long>(10000); static void Main(string[] args) { /* * The prime factors of 13195 are 5... 阅读全文
posted @ 2011-08-28 17:23 kiminozo 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 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 the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-value 阅读全文
posted @ 2011-08-28 17:21 kiminozo 阅读(314) 评论(0) 推荐(0) 编辑
摘要: 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. long result = 0; for (int i = 0; i < 1000; i++) { if (i%3 ==... 阅读全文
posted @ 2011-08-28 17:14 kiminozo 阅读(261) 评论(0) 推荐(0) 编辑