
欧拉计划(C语言)
文章平均质量分 66
xueda120
程序员
展开
-
(Problem 12)Highly divisible triangular number
The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:1, 3, 6, 10, 15, 21, 2...原创 2013-11-17 21:07:05 · 161 阅读 · 0 评论 -
(Problem 9)Special Pythagorean triplet
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 +...原创 2013-11-19 22:49:06 · 115 阅读 · 0 评论 -
(Problem 19)Counting Sundays
You are given the following information, but you may prefer to do some research for yourself.1 Jan 1900 was a Monday.Thirty days has September,April, June and November.All the rest have thirty-...原创 2013-11-19 22:50:06 · 133 阅读 · 0 评论 -
(Problem 28)Number spiral diagonals
Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:21 22 23 24 2520 7 8 9 1019 6 1 2 1118 5 4 3 1217 16 15 14 13It...原创 2013-11-20 11:31:30 · 124 阅读 · 0 评论 -
(Problem 34)Digit factorials
145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.Find the sum of all numbers which are equal to the sum of the factorial of their digits.Note: as 1! = 1 and 2! = 2 are not sums they...原创 2013-11-20 11:34:31 · 107 阅读 · 0 评论 -
(Problem 29)Distinct powers
Consider all integer combinations of ab for 2 a 5 and 2 b 5:22=4, 23=8, 24=16, 25=3232=9, 33=27, 34=81, 35=24342=16, 43=64, 44=256, 45=102452=25, 53=125, 54=625, 55=3125If they are then plac...2013-11-20 11:46:51 · 182 阅读 · 0 评论 -
(Problem 33)Digit canceling fractions
The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that49/98 = 4/8, which is correct, is obtained by cancelling the 9s....原创 2013-11-20 23:42:59 · 141 阅读 · 0 评论 -
(Problem 6)Sum square difference
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 differ...原创 2013-11-20 23:45:33 · 150 阅读 · 0 评论 -
(Problem 7)10001st prime
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? 题目大意:前六个质数是2,3,5,7,11和13,其中第6个是13.第10001个质数是多少?#inc...原创 2013-11-21 17:48:27 · 147 阅读 · 0 评论 -
(Problem 35)Circular primes
The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 7...原创 2013-11-24 00:02:20 · 179 阅读 · 0 评论 -
(Problem 92)Square digit chains
A number chain is created by continuously adding the square of the digits in a number to form a new number until it has been seen before.For example,44 32 13 10 1 185 89 145 42 20 4 1...原创 2013-11-24 18:30:07 · 177 阅读 · 0 评论 -
(Problem 21)Amicable numbers
Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).If d(a) = b and d(b) = a, where a b, then a and b are an amicable pair and each of a and b ar...原创 2013-11-19 22:47:45 · 155 阅读 · 0 评论 -
(Problem 42)Coded triangle numbers
The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangle numbers are:1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...By converting each letter in a word to a...原创 2013-11-19 11:38:46 · 188 阅读 · 0 评论 -
(Problem 36)Double-base palindromes
The decimal number, 585 = 10010010012 (binary), is palindromic in both bases.Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.(Please note that the ...原创 2013-11-17 21:17:39 · 148 阅读 · 0 评论 -
(Problem 14)Longest Collatz sequence
The following iterative sequence is defined for the set of positive integers:n n/2 (n is even)n 3n + 1 (n is odd)Using the rule above and starting with 13, we generate the following sequence:...原创 2013-11-17 21:20:59 · 117 阅读 · 0 评论 -
(Problem 46)Goldbach's other conjecture
It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a prime and twice a square.9 = 7 + 21215 = 7 + 22221 = 3 + 23225 = 7 + 23227 = 19 + 22233 = 31 + 2...原创 2013-11-17 21:23:06 · 95 阅读 · 0 评论 -
(Problem 41)Pandigital prime
We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once. For example, 2143 is a 4-digit pandigital and is also prime.What is the largest n-digit pand...原创 2013-11-17 21:26:03 · 116 阅读 · 0 评论 -
(Problem 1)Multiples of 3 and 5
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.#include &...原创 2013-11-18 00:35:38 · 116 阅读 · 0 评论 -
(Problem 2)Even Fibonacci numbers
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 t...原创 2013-11-18 00:36:05 · 168 阅读 · 0 评论 -
(Problem 5)Smallest multiple
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...原创 2013-11-18 00:36:24 · 121 阅读 · 0 评论 -
(Problem 16)Power digit sum
215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.What is the sum of the digits of the number 21000? 题目大意:215 = 32768 并且其各位之和为 is 3 + 2 + 7 + 6 + 8 = 26.21000 的各位数之和是多少? ...原创 2013-11-18 00:36:52 · 184 阅读 · 0 评论 -
(Problem 17)Number letter counts
If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.If all the numbers from 1 to 1000 (one thousand) inclusive ...原创 2013-11-18 00:37:19 · 221 阅读 · 1 评论 -
(Problem 22)Names scores
Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical ...原创 2013-11-19 01:08:28 · 241 阅读 · 0 评论 -
(Problem 37)Truncatable primes
The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we c...原创 2013-11-26 22:30:09 · 126 阅读 · 0 评论