This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A178000 #15 Jan 12 2019 02:27:19 %S A178000 2,29,229,2221,22229,922223,9222229,22222223,222222227,7222222229, %T A178000 22222222223,522222222229,9222222222229,22222222222229, %U A178000 222222222222227,9222222222222227,72222222222222221,222222222222222221 %N A178000 Largest n-digit prime with the maximum number of digits equal to 2. %C A178000 Select first for most 2's, then take the largest. %C A178000 In more detail: To get a(n), look at the list of all the n-digit primes. Suppose k is the maximum number of 2's of any number on the list. Throw out any prime on the list that does not contain k 2's. Then a(n) = maximal number that is left on the list. - _N. J. A. Sloane_, Mar 20 2018 %C A178000 For n <= 1000, a(n) has at most two non-2's. What is the first n for which it has more than two? - _Robert Israel_, Mar 20 2018 %H A178000 Robert Israel, <a href="/A178000/b178000.txt">Table of n, a(n) for n = 1..999</a> %p A178000 # This program will return FAIL if a(n) has more than two digits <> 2. %p A178000 f:= proc(n) %p A178000 local k1,d2,k2,t; %p A178000 for k1 in [9,7,3,1] do if isprime(2/9*(10^n-1)+k1-2) then return 2/9*(10^n-1)+k1-2 fi od; %p A178000 for d2 from n to 2 by -1 do %p A178000 for k2 in [9,8,7,6,5,4,3] do %p A178000 for k1 in [9,7,3,1] do %p A178000 t:= 2/9*(10^(n)-1)+(k2-2)*10^(d2-1) + k1-2; %p A178000 if isprime(t) then return t fi; %p A178000 od od od: %p A178000 FAIL %p A178000 end proc: %p A178000 f(1):= 2: %p A178000 seq(f(n),n=1..30); # _Robert Israel_, Mar 20 2018 %Y A178000 Cf. A037057, A099656, A177999. %K A178000 nonn,base %O A178000 1,1 %A A178000 _Lekraj Beedassy_, May 17 2010