# How Create a list of the first 10,000 digits of Pi and sum it?

I need help for a problem I m having trouble with. I need to create a list with the first 10'000 digits of Pi and sum the digits 259 to 7233.

I managed to create a list with the following code: list1 = RealDigits[Pi, 10, 10]

But then I am unable to do any computation with it.

Somebody can help me ?

Thanks !

• Why create a list of 10000 digits when you are not going to use any digit beyoun digit 7223? – m_goldberg Feb 21 at 22:23
• Why bother? It will be approximately equal to (7233 - 259 + 1) * (0 + 9) / 2 :-) – Selcuk Feb 22 at 0:57
• Related: (125025) – Mr.Wizard Feb 25 at 11:04

RealDigits[Pi, 10, 10000] // First // Take[#, {259, 7233}] & // Total

• Thanks it works as well! – user63037 Feb 21 at 21:03

Does this do what you want:

Total @ RealDigits[Pi, 10, 10^4][[1,259;;7233]]

• Thanks a lot it works! – user63037 Feb 21 at 21:03

You can use the four-argument of form of RealDigits:

• RealDigits[$$x, b, len, n$$] gives len digits starting with the coefficient of $$b^n$$.
m = 259;
n = 7233;
Total@First@RealDigits[Pi, 10, n - (m - 1), -(m - 1)]


31574

• That should be Total @ First @ RealDigits[Pi, 10, 7233 - 259 + 1, -258] instead. – Carl Woll Feb 22 at 1:19
• Thank you @CarlWoll. Fixed. – kglr Feb 22 at 1:58