# 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? Commented Feb 21, 2019 at 22:23
• Why bother? It will be approximately equal to (7233 - 259 + 1) * (0 + 9) / 2 :-) Commented Feb 22, 2019 at 0:57
• Related: (125025) Commented Feb 25, 2019 at 11:04

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

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

Does this do what you want:

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

• Thanks a lot it works!
– user63037
Commented Feb 21, 2019 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. Commented Feb 22, 2019 at 1:19
• Thank you @CarlWoll. Fixed.
– kglr
Commented Feb 22, 2019 at 1:58