%I #18 Jun 16 2021 10:16:14
%S 23,61,1123,1213,1231,1321,2113,2131,2311,3121,11161,11213,11321,
%T 12113,13121,16111,31121,111611,611111,1111213,1112113,1112131,
%U 1131121,1211311,2111311,3112111,11111161,11112113,11211131,11231111,11312111
%N Primes whose product of digits is 6.
%H Michael S. Branicky, <a href="/A107692/b107692.txt">Table of n, a(n) for n = 1..10199</a> (all terms with <= 136 digits; terms 1..1000 from Harvey P. Dale)
%t Union[ Flatten[ Table[ Select[ Sort[ FromDigits /@ Join[ Permutations[ Flatten[{6, Table[1, {n}]}]], Permutations[ Flatten[{2, 3, Table[ 1, {n - 1}]}] ]]], PrimeQ[ # ] &], {n, 0, 7}]]]
%t Select[Prime[Range[750000]],Times@@IntegerDigits[#]==6&] (* _Harvey P. Dale_, May 29 2016 *)
%o (Python)
%o from sympy import prod, isprime
%o from sympy.utilities.iterables import multiset_permutations
%o def agen(maxdigits):
%o for digs in range(1, maxdigits+1):
%o for mp in multiset_permutations("1"*(digs-1) + "236", digs):
%o if prod(map(int, mp)) == 6:
%o t = int("".join(mp))
%o if isprime(t): yield t
%o print(list(agen(8))) # _Michael S. Branicky_, Jun 16 2021
%Y Cf. A004022, A107612, A107689, A107690, A107691, A107693, A107694, A107695.
%Y Cf. A107696, A107697, A107698.
%K base,nonn
%O 1,1
%A _Zak Seidov_ and _Robert G. Wilson v_, May 20 2005
|