9

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 !

3 Answers3

7

Does this do what you want:

Total @ RealDigits[Pi, 10, 10^4][[1,259;;7233]]
user5601
  • 3,573
  • 2
  • 24
  • 56
6
RealDigits[Pi, 10, 10000] // First // Take[#, {259, 7233}] & // Total
Rohit Namjoshi
  • 10,212
  • 6
  • 16
  • 67
6

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

kglr
  • 394,356
  • 18
  • 477
  • 896