login
A358998
Nonprimes whose sum of factorials of digits is a prime.
1
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,1
LINKS
FORMULA
A165451 INTERSECT A002808. - R. J. Mathar, Feb 23 2023
EXAMPLE
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.
MATHEMATICA
Select[Range[1000], ! PrimeQ[#] && PrimeQ[Total[IntegerDigits[#]!]] &] (* Amiram Eldar, Feb 11 2023 *)
PROG
(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
CROSSREFS
Cf. A061602, A084405 (Primes such that the sum of the factorials of the digits is also prime).
Sequence in context: A225742 A338855 A221638 * A085772 A162189 A186438
KEYWORD
base,easy,nonn
AUTHOR
Carole Dubois, Feb 11 2023
STATUS
approved