The sum of k consecutive primes is a prime number.
List all the possibilties for k=2,3,5 and 7 with the sums under 300.
Even values of k must of course start with 2, and so are the sum of the first k primes, as there needs to be an odd number of odd primes. k = 4, 6, 12 and 14 in fact work. Above k=14, there is no solution with the sum being under 300.
k first and
last primes sum
2
2 2 3 5
3
3 5 11 23
3 7 13 31
3 11 17 41
3 17 23 59
3 19 29 71
3 23 31 83
3 29 37 97
3 31 41 109
3 41 47 131
3 53 61 173
3 61 71 199
3 67 73 211
3 71 79 223
3 79 89 251
3 83 97 269
4
4 2 7 17
5
5 5 17 53
5 7 19 67
5 11 23 83
5 13 29 101
5 19 37 139
5 29 43 181
5 31 47 199
5 43 61 263
6
6 2 13 41
7
7 17 41 197
7 19 43 223
7 23 47 251
7 29 53 281
8
9
9 3 29 127
10
11
11 5 41 233
11 7 43 271
12
12 2 37 197
13
14
14 2 43 281
5 dim H(21)
10 for K=2 to 14
15 print K
20 P=0:Tot=0:Ct=0:erase H():dim H(21)
30 while P<2000
40 P=nxtprm(P)
50 Tot=Tot-H(1)
60 for I=1 to K-1
70 H(I)=H(I+1)
80 next I
90 H(K)=P
100 Tot=Tot+P:inc Ct
110 if prmdiv(Tot)=Tot and Tot<300 and Ct>=K then print K,H(1);H(K),Tot
120 wend
130 next K
|
Posted by Charlie
on 2012-03-26 11:35:23 |