0%

Problem 214


Problem 214


Totient Chains

Let φ be Euler’s totient function, i.e. for a natural number n, φ(n) is the number of k, 1 ≤ k ≤ n, for which gcd(k,n) = 1.

By iterating φ, each positive integer generates a decreasing chain of numbers ending in 1.
E.g. if we start with 5 the sequence 5,4,2,1 is generated.
Here is a listing of all chains with length 4:

 5,4,2,1
 7,6,2,1
 8,4,2,1
 9,6,2,1
10,4,2,1
12,4,2,1
14,6,2,1
18,6,2,1

Only two of these chains start with a prime, their sum is 12.

What is the sum of all primes less than 40000000 which generate a chain of length 25?


总计函数链

令φ表示欧拉总计函数,也就是说,对于自然数n,所有1 ≤ k ≤ n且gcd(k,n) = 1的正整数k的数目记为φ(n)。

通过迭代求φ,每个正整数都能生成一条不断下降最终以1结束的链。
例如,如果我们从5开始,生成的序列为5、4、2、1。
如下所列是所有长度为4的链:

5,4,2,1
7,6,2,1
8,4,2,1
9,6,2,1
10,4,2,1
12,4,2,1
14,6,2,1
18,6,2,1

其中只有两条链从素数开始,这两个素数的和为12。

在小于40000000的素数中,能生成长度为25的链的素数之和是多少?