0%

Problem 425


Problem 425


Prime connection

Two positive numbers A and B are said to be connected (denoted by “A ↔ B”) if one of these conditions holds:
(1) A and B have the same length and differ in exactly one digit; for example, 123 ↔ 173.
(2) Adding one digit to the left of A (or B) makes B (or A); for example, 23 ↔ 223 and 123 ↔ 23.

We call a prime P a 2’s relative if there exists a chain of connected primes between 2 and P and no prime in the chain exceeds P.

For example, 127 is a 2’s relative. One of the possible chains is shown below:
2 ↔ 3 ↔ 13 ↔ 113 ↔ 103 ↔ 107 ↔ 127
However, 11 and 103 are not 2’s relatives.

Let F(N) be the sum of the primes ≤ N which are not 2’s relatives.
We can verify that F(103) = 431 and F(104) = 78728.

Find F(107).


素数连接

两个正整数A和B被称为相连的(用”A ↔ B”表示)如果以下条件之一成立:
(1)A和B的位数相同,且只有一位数字不同,例如123 ↔ 173。
(2)在A(或B)的左侧加一位数字即得到B(或A),例如23 ↔ 223和123 ↔ 23。

我们称素数P是2的亲戚,如果能用相连的素数组成的链连接2和P,且这些素数都不超过P。

例如,127是2的亲戚。其中一种素数串如下所示:
2 ↔ 3 ↔ 13 ↔ 113 ↔ 103 ↔ 107 ↔ 127
然而,11和103不是2的亲戚。

记F(N)是所有≤ N且不是2的亲戚的素数和。
可以验证F(103) = 431以及F(104) = 78728。

求F(107)。