Problem #190

The Best Sub-sequence
Public 12/21/14 8xp Programming 76.9%

Consider the decimal part of PI by groups of 2 digits.
We get the following sequence for the 20 first elements:
Subtract from each element of this sequence 50:
You can verify that the sub-sequence starting at index 3 and ending at index 7 (42,15,-15,39,29) has the largest sum: 110.

Now group the decimal part of PI by groups of 10 digits and subtract 10^10/2 from each element.

We get the sequence:
S  = -3584073465,3979323846,-2356616721,28841971,1939937510,820974944,923078164,-4371379101,3628034825,-1578829321, ...
What is the sub-sequence with the largest sum in the first 5,000,000 elements of S?

Answer format: Sum,Starting index,Ending index

Example: 110,3,7

[My timing: 2 sec] // Computation of PI not included!

You need to be a member to keep track of your progress.

Time may end, but hope will last forever.

Other Challenge Sites