0%

Problem 196


Problem 196


Prime triplets

Build a triangle from all positive integers in the following way:

                     
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35 36
37 38 39 40 41 42 43 44 45
46 47 48 49 50 51 52 53 54 55
56 57 58 59 60 61 62 63 64 65 66
.. .. ..

Each positive integer has up to eight neighbours in the triangle.

A set of three primes is called a prime triplet if one of the three primes has the other two as neighbours in the triangle.

For example, in the second row, the prime numbers 2 and 3 are elements of some prime triplet.

If row 8 is considered, it contains two primes which are elements of some prime triplet, i.e. 29 and 31.
If row 9 is considered, it contains only one prime which is an element of some prime triplet: 37.

Define S(n) as the sum of the primes in row n which are elements of any prime triplet.
Then S(8)=60 and S(9)=37.

You are given that S(10000)=950007619.

Find  S(5678027) + S(7208785).


素数三元组

将所有正整数按如下方式排列成三角形的样式:

                     
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35 36
37 38 39 40 41 42 43 44 45
46 47 48 49 50 51 52 53 54 55
56 57 58 59 60 61 62 63 64 65 66
.. .. ..

每个正整数在三角形中有最多八个邻居。

如果三个素数中,有两个均为另一个的邻居,那么这一组三个素数被称为一个素数三元组

例如,在第二行,素数2和3都是一些素数三元组的元素。

如果我们看第8行,将有两个素数属于某些素数三元组,这两个素数是29和31。
如果我们看第9行,只有一个素数属于某些素数三元组,这个素数是37。

记S(n)是第n行中属于某些素数三元组的素数之和。
因此S(8)=60,而S(9)=37。

已知S(10000)=950007619。

求S(5678027) + S(7208785)。