OFFSET
1,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
FORMULA
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
KEYWORD
base,easy,nonn
AUTHOR
Carole Dubois, Feb 11 2023
STATUS
approved