login
Smallest n-digit prime containing only digits 1 and 9, or 0 if no such prime exists.
1

%I #14 May 26 2020 15:50:40

%S 0,11,191,1999,11119,111119,1111991,11111119,111111199,1111111919,

%T 11111111911,111111199919,1111111119919,11111111119111,

%U 111111111119119,1111111111111999,11111111111111119,111111111111191111

%N Smallest n-digit prime containing only digits 1 and 9, or 0 if no such prime exists.

%H Jinyuan Wang, <a href="/A036936/b036936.txt">Table of n, a(n) for n = 1..500</a>

%t Table[SelectFirst[FromDigits/@Tuples[{1,9},n],PrimeQ],{n,20}]/. Missing["NotFound"]->0 (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, May 26 2020 *)

%Y Cf. A020457, A036229, A036309.

%K nonn,base

%O 1,2

%A _Patrick De Geest_, Jan 04 1999