OFFSET
1,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
EXAMPLE
347 is a 3-digit prime number. The product of its digits is 84. The sum of its digits is 14. As 84 = 2*3*14, this number is in the sequence.
MAPLE
q:= n-> (l-> mul(i, i=l)=2*nops(l)*add(i, i=l))(convert(n, base, 10)):
select(q, [ithprime(j)$j=1..100000])[]; # Alois P. Heinz, May 30 2021
MATHEMATICA
Select[Range[1000000], PrimeQ[#] && Times@@IntegerDigits[#] == 2 Length[IntegerDigits[#]] Total[IntegerDigits[#]] &]
Select[Prime[Range[22000]], Times@@IntegerDigits[#]==2(IntegerLength[#]Total[ IntegerDigits[ #]])&] (* Harvey P. Dale, Jun 30 2023 *)
PROG
(Python)
from math import prod
from sympy import isprime
from sympy.utilities.iterables import multiset_permutations as mp
from itertools import count, islice, combinations_with_replacement as mc
def c(s):
d = list(map(int, s))
return prod(d) == 2*len(d)*sum(d)
def agen():
for d in count(2):
okset = set()
for cand in ("".join(m) for m in mc("987654321", d)):
if c(cand):
for p in mp(cand, d):
t = int("".join(p))
if isprime(t): okset.add(t)
yield from sorted(okset)
print(list(islice(agen(), 41))) # Michael S. Branicky, Nov 30 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Tanya Khovanova, May 26 2021
STATUS
approved