Thursday, September 18, 2014

Sum Of Consecutive Primes - Part 2

When I wrote the blog post on “Sum Of Consecutive Primes” I said that it was a pure D! activity. This is D!^2 :-)

One of the comments on the post suggested to do the analysis to find even more special primes. I liked the suggestion and modified my code to look for even more special primes. What kind of specialty are we talking about?

Please read the original blog post for more details. As a quick recap, we are looking for primes that can be written as sum of consecutive primes.

Obtaining primes from adding consecutive primes is just beautiful. As the analysis shows, many of these prime numbers can be written as multiple different sequences of consecutive primes. Some of these sequences are surprisingly large.

Within such primes, how about finding some more specializations, as follows.
1. The length of at least one the sequence itself is prime.
2. More specialization of the first, length of EVERY sequence is prime.
3. For a particular prime, the number of different generating sequences is also a prime.
4. Intersection of 2, and 3 : the number of sequences is prime, and length of every sequence is also prime.

In each case, we are looking for the primes below an arbitrary limit, which is 1 million for Problem 50 in Project Euler.

So here are the answers.

1. At least one sequence with prime length

The largest prime is
999983 = 34337 + 34351 + … + 34613 (29 primes)

The largest sequence is for
981391 = 71 + 73 + … + 3917 (523 primes)

The prime 442019 is noteworthy, as it has the six generating sequences, maximum for this subset. Only the first sequence is of prime length.
442019 = 419 + 421 + … + 2621 (301 primes)
442019 = 7529 + 7537 + … + 8017 (57 primes)
442019 = 13229 + 13241 + … + 13567 (33 primes)
442019 = 17569 + 17573 + … + 17807 (25 primes)
442019 = 49069 + 49081 + … + 147347 (9 primes)

2 All generating sequences are of prime length
There have to be more than 1 generating sequences to be qualified for this criterion.

The largest is
999863 = 13723 + 13729 + … + 14447 (71 primes)
999863 = 199933 + … + 200003 (5 primes)

The largest sequence in this subset is for
973691 = 61 + 67 + … + 3907 (523 primes)
Interestingly it’s the same length (523) for the largest sequence for the previous subset above.

Most prime sequences are for
999049 = 4801 + 4813 + … + 6337 (179 primes)
999049 = 7013 + 7019 + … + 8231 (131 primes)
999049 = 21019 + 21023 + … + 21493 (47 primes)
999049 = 199799 + … + 199819 (5 primes)

3. Number of generating sequence is prime
The largest is same as above 999863.

The largest sequence is for a prime that is an answer to the Project Euler : Problem 50, so I cannot give it here.

The most sequences are for
988321 = 113 + 127 + … + 3923 (515 primes)
988321 = 4673 + 4679 + .. + 6247(181 primes)
988321 = 5107 + 5113 +  … + 6577 (169 primes)
988321 = 89797 + 89809 + … + 89899 (11 primes)
988321 =  329419 + 329431 + 329471
Note that 2nd and 3rd of the above are overlapping sequences!

4. Primest of primes
Now let’s see which are the most special of these. These have ONLY a prime number ways of generating sequences, and length of each of these sequences is also prime.

The largest is 999863, same as subset 2 above.

The largest sequence in this subset is also for the same prime as for subset 2 above.
973691 = 61 + 67 + … + 3907 (523 primes)
973691 = 6841 + 6857 + …  + 8039 (131 primes)
So there are 2 sequences, each has prime number of primes.

And the most sequences are for
993367 = 13679 + 13681 + … + 14387 (71 primes)
993367 = 141863 + 141871 + … + 141941 (7 primes)
993367 = 331099 + 331127 + 331141
Now that’s one beautiful number. It’s the largest prime below 1 million that can be written in most prime number of different ways as sum of prime number of consecutive primes :-)



No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...