A282974
Numbers k such that A011546(k-1) is a prime.
Original entry on oeis.org
1, 2, 6, 12, 1902, 3971, 5827, 16208, 47577
Offset: 1
-
Do[If[PrimeQ[Round[Pi*10^(n-1)]],Print[n]],{n,17511}]
-
default(realprecision, 10^5); x=Pi;
is(k) = ispseudoprime(round(x*10^k--)); \\ Jinyuan Wang, Mar 27 2020
A283247
a(n) is the smallest prime number whose representation contains as a substring the first n digits of Pi in base 10.
Original entry on oeis.org
3, 31, 13147, 73141, 314159, 314159, 131415923, 1314159269, 23141592653, 23141592653, 314159265359, 3141592653581, 213141592653589, 1131415926535897, 9314159265358979, 173141592653589793, 3141592653589793239, 3141592653589793239, 314159265358979323861
Offset: 1
a(4) = 73141 since 73141 is the smallest prime number that contains 3141 (the first 4 digits of Pi).
a(5) = 314159 since 314159 is the smallest prime number that contains 31415.
a(6) = 314159 since 314159 is the smallest prime number that contains 314159.
-
pp[n_] := If[PrimeQ@n, n, Block[{d = IntegerDigits@n, p, s, t}, p = 10^Length[d]; s = Select[Join[Range[9] p + n, {1,3,7,9} + 10 n], PrimeQ]; If[s != {}, Min@s, s = NextPrime[100 n]; t = Join[If[Floor[s/100] == n, {s}, {}], Range[10, 99] p + n, FromDigits /@ Flatten /@ Tuples[{Range@9, {d}, {1, 3, 7, 9}}]]; s = Select[t, PrimeQ]; If[s == {}, 0, Min@s]]]]; Table[pp[Floor[10^e Pi]], {e, 0, 18}] (* Giovanni Resta, Jul 21 2017 *)
-
pi_digits = pi_digit_generator #user-defined generator for producing next digit of Pi
next_digit = pi_digits.next() #first call, so next_digit = 3
primes = prime_generator #user-defined generator for producing next prime
current_prime = primes.next() #first call, so current_prime = 2
pi_progress = 0
while True:
pi_progress = pi_progress*10 + next_digit
while str(pi_progress) not in str(current_prime):
current_prime = primes.next()
print(pi_progress,current_prime)
Showing 1-2 of 2 results.
Comments