%I #13 Apr 29 2021 01:36:32
%S 99,987,9951,99939,996983,9981153,99745289,981196517,9927756573,
%T 99243774623,992617385333,9751651447377
%N a(n) = largest composite number of n decimal digits that becomes prime by decreasing any one of the higher-order digits.
%C a(n) == 0 (mod 7) for n > 6.
%C What is the first n for which a(n) does not exist? Rough heuristics suggest before 20. - _Charles R Greathouse IV_, Nov 18 2010
%e a(5)=99939 is included as 99929, 998939, 98939 and 89939 are primes.
%o (PARI) A124113(d)={
%o forstep(n=10^d-1,10^d\9,[-2,-4,-2,-2],
%o if(isA124113(n,d),return(n))
%o )
%o };
%o isA124113(n,d)={
%o if(n%3==1,return(0));
%o for(i=1,d-1,
%o if(!isprime(n-10^i),return(0))
%o );
%o my(v=eval(Vec(Str(n))));
%o for(i=1,#v,
%o if(v[i]==0,return(0))
%o );
%o !isprime(n)
%o };
%K hard,nonn,base
%O 2,1
%A Anton Vrba (antonvrba(AT)yahoo.com), Nov 29 2006
%E a(2) corrected, a(7) inserted, and a(11)-a(12) added by _Charles R Greathouse IV_, Nov 15 2010
%E a(13) added by _Charles R Greathouse IV_, Nov 17 2010