A058938 Numbers k such that the sum of the first k digits of the decimal expansion of Pi is prime.
1, 6, 8, 13, 20, 21, 34, 36, 48, 56, 63, 87, 89, 92, 94, 104, 106, 107, 111, 116, 117, 118, 120, 130, 132, 133, 141, 146, 147, 162, 170, 173, 179, 183, 185, 186, 198, 202, 203, 206, 215, 217, 219, 220, 225, 242, 248, 249, 258, 264, 265, 270, 271, 285, 290, 291
Offset: 1
Examples
6 is a term because 3 + 1 + 4 + 1 + 5 + 9 = 23, which is prime.
Programs
-
Maple
Digits := 2000: it := evalf(Pi, 2000): for i from 1 to 2000 do a[i] := floor(it): it := 10*(it-floor(it)): od: s := 0: for i from 1 to 2000 do s := s+a[i]: if isprime(s) then printf(`%d,`,i) fi: od:
-
Mathematica
a = First[ RealDigits[ N[ Pi, 300]]]; Do[ If[ PrimeQ[Plus @@ Take[a, n]], Print[n]], {n, 1, 300}] Flatten[Position[Accumulate[RealDigits[\[Pi],10,500][[1]]], ?PrimeQ]] (* _Harvey P. Dale, Apr 03 2011 *)
Extensions
More terms from James Sellers, Jan 14 2001