%I #14 Mar 03 2016 22:54:44
%S 7,71,911,8111,16111,911111,1171111,71111111,131111111,1711111111,
%T 31111111111,311111111111,5111111111111,41111111111111,
%U 111151111111111,5111111111111111,11111611111111111,191111111111111111,2111111111111111111,11111111611111111111
%N Largest n digit prime having at least n-1 digits equal to 1.
%H Michel Lagneau, Michael De Vlieger and Robert G. Wilson v, <a href="/A268702/b268702.txt">Table of n, a(n) for n = 1..1000</a>
%e a(3) = 911 since 111, 211, 311, ..., 811 are all composites but 911 is prime. Also of the ten primes of 3 digits which contain at least 2 ones, {101, 113, 131, 151, 181, 191, 211, 311, 811, 911}, 911 is the greatest.
%t f[n_] := Block[{k = 0, p = {}, r = (10^n - 1)/9, s = Range@ 10 - 2}, While[k < n, AppendTo[p, Select[r + 10^k*s, PrimeQ]]; k++]; p = Max@ Flatten@ p]; Array[f, 20]
%o (PARI) a(n) = {p = precprime(10^n-1); while (#select(x->x==1, digits(p)) != n-1, p = precprime(p-1)); p;} \\ _Michel Marcus_, Feb 21 2016
%Y Cf. A177999, A241100, A268703 - A268707, A241206.
%K nonn,base
%O 1,1
%A _Michel Lagneau_, _Michael De Vlieger_ and _Robert G. Wilson v_, Feb 11 2016