login
a(n) = smallest prime q of form q=-1+(p+1)*10^w, where p is n-th prime, or 0 if there is no such prime.
2

%I #32 Jan 06 2023 09:55:56

%S 29,0,59,79,1199999,139,179,199,239,2999,

%T 319999999999999999999999999999,379,419,439,479,5399,599,619,679999,

%U 719,739,79999,839,8999,97999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999

%N a(n) = smallest prime q of form q=-1+(p+1)*10^w, where p is n-th prime, or 0 if there is no such prime.

%C Branicky searched n<=10000 to 1000 digits.

%C a(87) = 45*10^11959-1 (11961 digits). - _Sidney Cadot_, Jan 06 2023

%H Michael S. Branicky, <a href="/A055785/b055785.txt">Table of n, a(n) for n = 1..86</a>

%H Michael S. Branicky, <a href="/A055785/a055785.txt">Table of n, a(n) for n = 1..10000</a> (with "None" if the solution is unknown, with each such value tested to at least 1000 digits).

%e 25th term is 9799...999, i.e., digits of Prime[25]=97 are followed by 90 copies of digit 9.

%o (Python)

%o from sympy import isprime, prime

%o def a(n, wlimit=1000):

%o if n == 2: return 0

%o pn, w = str(prime(n)), 1

%o while not isprime(int(pn+"9"*w)):

%o w += 1

%o if w > wlimit: return -1

%o return int(pn+"9"*w)

%o print([a(n) for n in range(1, 26)]) # _Michael S. Branicky_, May 07 2022

%K base,nonn

%O 1,1

%A _Labos Elemer_, Jul 13 2000

%E Revised to handle p=3 by _Sean A. Irvine_, Apr 05 2022