%I #19 Jul 18 2021 03:05:28
%S 2,10,34,499,1746
%N Numbers k such that k! is turned into a prime number by changing its trailing 0's into 1's.
%C Also numbers k such that n! + R(Z(k)) is prime, where R(t) = (10^t - 1)/9 is the repunit with t digits (A002275) and Z(m) = Sum_{j>=1} floor(m/5^j) is the number of trailing zeros of m! (A027868). The (probable) prime corresponding to a(5)=1746 has 4905 digits. Next term must be greater than 4000.
%e 10 is a term, since 10! = 3628800 and 3628811 is prime.
%p q:= n-> (f-> isprime(f+(10^padic[ordp](f, 10)-1)/9))(n!):
%p select(q, [$1..500])[]; # _Alois P. Heinz_, Feb 10 2021
%t tz1Q[n_]:=Module[{idn=Split[IntegerDigits[n!]]},PrimeQ[ FromDigits[ Flatten[ Join[ Most[ idn], Last[idn]/.(0->1)]]]]]; Select[ Range[ 1800],tz1Q] (* _Harvey P. Dale_, Oct 01 2015 *)
%o (Python)
%o from sympy import isprime
%o from math import factorial
%o def ok(n):
%o s, zeros = str(factorial(n)), 0
%o while s[-1] == '0': s = s[:-1]; zeros += 1
%o return isprime(int(s + '1'*zeros))
%o print([m for m in range(500) if ok(m)]) # _Michael S. Branicky_, Feb 10 2021
%Y Cf. A000142, A002275, A027868.
%K nonn,base,hard,more
%O 1,1
%A _Giovanni Resta_, Mar 07 2006
|