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.

A358998 Nonprimes whose sum of factorials of digits is a prime.

Original entry on oeis.org

10, 12, 20, 21, 30, 100, 110, 111, 122, 133, 134, 135, 136, 143, 153, 155, 178, 187, 202, 212, 220, 221, 303, 304, 305, 306, 314, 315, 316, 330, 340, 341, 350, 351, 360, 361, 403, 413, 430, 505, 513, 515, 530, 531, 550, 551, 603, 630, 708, 718, 780, 781, 807
Offset: 1

Views

Author

Carole Dubois, Feb 11 2023

Keywords

Examples

			134 is in the sequence because it is not prime and 1! + 3! + 4! = 1 + 6 + 24 = 31 which is a prime number.
202 is also in the sequence because it is not prime and 2! + 0! + 2! = 5 prime.
		

Crossrefs

Cf. A061602, A084405 (Primes such that the sum of the factorials of the digits is also prime).

Programs

  • Mathematica
    Select[Range[1000], ! PrimeQ[#] && PrimeQ[Total[IntegerDigits[#]!]] &] (* Amiram Eldar, Feb 11 2023 *)
  • Python
    from sympy import isprime
    from math import factorial
    S=[]
    nomb=200
    i=0
    while len(S) < nomb:
        i+=1
        if isprime(i):
            continue
        som=0
        for j in range(len(str(i))):
            som+=factorial(int(ix[j]))
        if  not isprime(som):
            continue
        S.append(i)
    
  • Python
    from sympy import isprime
    from math import factorial
    def f(n): return sum(factorial(int(d)) for d in str(n))
    def ok(n): return not isprime(n) and isprime(f(n))
    print([k for k in range(900) if ok(k)]) # Michael S. Branicky, Feb 11 2023

Formula

A165451 INTERSECT A002808. - R. J. Mathar, Feb 23 2023