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-one,Saving February alone,Which has twenty-eight,
n! means n (n 1) ... 3 2 1 For example, 10! = 10 9 ... 3 2 1 = 3628800,and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27. Find the sum of the digits in the number 100! 這個對於python來說實在太小兒科了。一句話的事:print sum(int(x)
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 are called amicable numbers. For example, the proper
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 13 It can be verified that the sum of the numbers on the diagonals is 101.
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. 意思很明白找出這樣的a, b, ca+b+c = 1
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. 找出小於2,000,000裡面的質數然後求和。 不用什麼好辦法,2000000,這個數不算太大,直接求解。在能節省空間的和時間的地方盡量節省。比如可以使用unsigned long, 就不要使用double。可以使用%
文章目錄 整數分解 The sequence of triangle numbers is generated by adding the natural numbers. So the 7^(th) triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be: 1, 3, 6, 10, 15, 21, 28, 36, 45,
Work out the first ten digits of the sum of the following one-hundred 50-digit numbers. 371072875339021027987979982208375902465101357402504637693767749000971264812489697007805041701826053874324986199524741059474233309513058123726617309629919422133635
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: 13 40 20 10 5 16 8 4 2 1 It can be seen that
Starting in the top left corner of a 22 grid, there are 6 routes (without backtracking) to the bottom right corner. How many routes are there through a 2020 grid? 從 2*2的一個角到達另外一個對角有6條線路,問從 20*20的一個角到達另外一個對角有多少條線路? 這個要是運用組合數學的知識就好解決了。下面是組合數學的一個東東:
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? 計算 2 的 1000次方的所有數位和?這個設計大數乘方問題,我自己寫了一個計算大數乘方的函數來計算。先來說下如何計算大數乘方的問題吧,通用的思路就是採用數組來分段處理大數,分段表示大數。(使用鏈表的話,其實也會更簡單,更省空間的)下面的演算法中,我採用的是“萬進位”
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 were written out in words, how many letters
By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.37 42 4 68 5 9 3That is, 3 + 7 + 4 + 9 = 23.Find the maximum total from top to bottom of the triangle below:7595