cp's OEIS Frontend

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.

A371565 Integers k such that removing the even digits from k! yields a prime number.

This page as a plain text file.
%I A371565 #21 Apr 22 2024 10:42:57
%S A371565 6,7,8,9,10,13,18,20,21,23,25,82,119,137,2389,4108,5875
%N A371565 Integers k such that removing the even digits from k! yields a prime number.
%C A371565 For k > 4, the number k! is divisible by 10. In fact, for k > 1, the final nonzero digit of k! is even (see A008904). Then, if the even digits of k! are removed, the result is either 0 or an odd number, where the latter are candidates for prime numbers. Thus, with this procedure, it is possible to obtain the following prime numbers, although not in this order of occurrence: 3, 5, 7, 3917, 373757, 5517397, 519917179, 155111333959.
%e A371565 13 is a term since 13! = 6227020800 and eliminating the even digits yields the number 7, which is prime.
%e A371565 18 is a term since 18! = 6402373705728000 and eliminating the even digits yields 373757, which is prime.
%t A371565 q[n_] := PrimeQ[FromDigits[Select[IntegerDigits[n!], OddQ]]]; Select[Range[200], q] (* _Amiram Eldar_, Mar 30 2024 *)
%o A371565 (Python)
%o A371565 from sympy import isprime
%o A371565 from math import factorial
%o A371565 def ok(n):
%o A371565     r = "".join(d for d in str(factorial(n)) if d in "13579")
%o A371565     return len(r) and isprime(int(r))
%o A371565 print([k for k in range(1000) if ok(k)]) # _Michael S. Branicky_, Mar 27 2024
%o A371565 (Python) # generator of terms, removing trailing 0's from n!
%o A371565 from sympy import isprime
%o A371565 from itertools import count, islice
%o A371565 def agen():
%o A371565     f = 1
%o A371565     for n in count(1):
%o A371565         f *= n
%o A371565         q, t = divmod(f, 10)
%o A371565         while t == 0:
%o A371565             f = q
%o A371565             q, t = divmod(f, 10)
%o A371565         r = "".join(d for d in str(f) if d in "13579")
%o A371565         if len(r) and isprime(int(r)):
%o A371565             yield n
%o A371565 print(list(islice(agen(), 14))) # _Michael S. Branicky_, Apr 10 2024
%o A371565 (PARI) isok(k) = my(d=digits(k!)); ispseudoprime(fromdigits(select(x->(x%2), d))); \\ _Michel Marcus_, Mar 30 2024
%Y A371565 Cf. A000040, A000142.
%K A371565 nonn,base,more
%O A371565 1,1
%A A371565 _Gonzalo Martínez_, Mar 27 2024
%E A371565 a(12)-a(17) from _Michael S. Branicky_, Mar 27 2024