login
Numbers k such that the first k ternary digits found in the decimal expansion of Pi form a prime.
0

%I #12 Apr 11 2021 16:12:10

%S 264,274,322,751,3112,24842,32731

%N Numbers k such that the first k ternary digits found in the decimal expansion of Pi form a prime.

%t 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} ]

%t 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 *)

%Y Cf. A065832.

%K nonn,base

%O 1,1

%A _Robert G. Wilson v_, Nov 30 2001

%E a(6)-a(7) from _Chai Wah Wu_, Apr 07 2020