天天看點

歐拉計劃21-23題

21、

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 divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44,

55 and 110; therefore d(220) = 284. The proper divisors of 284 are 1, 2, 4, 71

and 142; so d(284) = 220.

Evaluate the sum of all the amicable numbers under 10000.

題目大意:

d(n)定義為n 的所有真因子(小于 n 且能整除 n 的整數)之和。 如果 d(a)

= b 并且 d(b) = a, 且 a  b, 那麼 a 和 b 就是一對相親數(amicable

pair),并且 a 和 b 都叫做親和數(amicable number)。

例如220的真因子是 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 和 110; 是以 d(220) = 284.

284的真因子是1, 2, 4, 71 和142; 是以d(284) = 220.

計算10000以下所有親和數之和。

View Code

Answer:31626

Completed

on Wed, 24 Jul 2013, 06:07

22、

Using  (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 value for each name, multiply this value by its

alphabetical position in the list to obtain a name score.

For example, when the list is sorted into alphabetical order, COLIN, which is

worth 3 + 15 + 12 + 9 + 14 = 53, is the 938th name in the list. So, COLIN would

obtain a score of 938  53 = 49714.

What is the total of all the name scores in the file?

檔案 (右鍵另存為)是一個46K大小的文本檔案,包含5000多個英文名字。利用這個檔案,首先将檔案中的名字按照字母排序,然後計算每個名字的字母值,最後将字母值與這個名字在名字清單中的位置相乘,得到這個名字的得分。

例如将名字清單按照字母排序後, COLIN這個名字是清單中的第938個,它的字母值是3 + 15 + 12 + 9 + 14 =

53。是以COLIN這個名字的得分就是938  53 = 49714.

檔案中所有名字的得分總和是多少?

Answer:871198282

Completed on Mon, 18

Nov 2013, 15:03

23、

A perfect number is a number for which the sum of its proper divisors is

exactly equal to the number. For example, the sum of the proper divisors of 28

would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.

A number n is called deficient if the sum of its proper

divisors is less than n and it is called abundant if this

sum exceeds n.

As 12 is the smallest abundant number, 1 + 2 + 3 + 4 + 6 = 16, the smallest

number that can be written as the sum of two abundant numbers is 24. By

mathematical analysis, it can be shown that all integers greater than 28123 can

be written as the sum of two abundant numbers. However, this upper limit cannot

be reduced any further by analysis even though it is known that the greatest

number that cannot be expressed as the sum of two abundant numbers is less than

this limit.

Find the sum of all the positive integers which cannot be written as the sum

of two abundant numbers.

如果一個數的所有真因子之和等于這個數,那麼這個數被稱為完全數。例如,28的所有真因子之和為1 + 2 + 4 + 7 + 14 =

28,是以28是一個完全數。

如果一個數的所有真因子之和小于這個數,稱其為不足數,如果大于這個數,稱其為過剩數。

12是最小的過剩數,1 +

2 + 3 + 4 + 6 =

16。是以最小的能夠寫成兩個過剩數之和的數字是24。經過分析,可以證明所有大于28123的數字都可以被寫成兩個過剩數之和。但是這個上界并不能被進一步縮小,即使我們知道最大的不能表示為兩個過剩數之和的數字要比這個上界小。

找出所有不能表示為兩個過剩數之和的正整數之和。

Answer:4179871

Completed on Sun, 13

Apr 2014, 08:23