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:
14,15,92,65,35,89,79,32,38,46,26,43,38,32,79,50,28,84,19,71
Subtract from each element of this sequence 50:
-36,-35,42,15,-15,39,29,-18,-12,-4,-24,-7,-12,-18,29,0,-22,34,-31,21
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.
Register


Time may end, but hope will last forever.

Other Challenge Sites

Contact

elasolova
[64][103][109][97][105][108][46][99][111][109]