|
MATHEMATICA
|
p = First[ RealDigits[ Pi, 10, 10^5]]; p = p[[ Select[ Range[10^5], p[[ # ]] == 0 || p[[ # ]] == 1 || p[[ # ]] == 2 & ]]]; Do[ If[ PrimeQ[ FromDigits[ Take[p, n], 3]], Print[n]], {n, 1, 4000} ]
Module[{nn=30000, pd}, pd=Select[RealDigits[Pi, 10, nn][[1]], #<3&]; Select[ Range[ Length[pd]], PrimeQ[FromDigits[Take[pd, #], 3]]&]] (* The program generates the first five terms of the sequence. To generate more, increase the constant for "nn, " but it will take a long time to run and the value of nn may be to be 150, 000 or more. *) (* Harvey P. Dale, Jul 31 2020 *)
|