login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Smallest prime obtained by appending one or more 9's to n, -1 if no such prime exists.
1

%I #18 Jul 08 2024 19:25:40

%S 19,29,-1,499,59,-1,79,89,-1,109,1199999,-1,139,149,-1,1699,179,-1,

%T 199,2099,-1,229,239,-1,25999,269,-1,289999,2999,-1,

%U 319999999999999999999999999999,3299,-1,349,359,-1,379,389,-1,409,419,-1,439,449,-1

%N Smallest prime obtained by appending one or more 9's to n, -1 if no such prime exists.

%H Toshitaka Suzuki, <a href="/A373859/b373859.txt">Table of n, a(n) for n = 1..448</a>

%F a(11) = 1199999 because 119, 1199, 11999 and 119999 are not primes.

%o (Python)

%o from itertools import count

%o from sympy import isprime

%o def A373859(n): return next(p for p in ((n+1)*10**m-1 for m in count(1)) if isprime(p)) if n%3 else -1 # _Chai Wah Wu_, Jul 08 2024

%Y Cf. A030433, A373201, A112386, A372056, A113076.

%K base,sign

%O 1,1

%A _Toshitaka Suzuki_, Jun 19 2024