A107692 Primes whose product of digits is 6.
23, 61, 1123, 1213, 1231, 1321, 2113, 2131, 2311, 3121, 11161, 11213, 11321, 12113, 13121, 16111, 31121, 111611, 611111, 1111213, 1112113, 1112131, 1131121, 1211311, 2111311, 3112111, 11111161, 11112113, 11211131, 11231111, 11312111
Offset: 1
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10199 (all terms with <= 136 digits; terms 1..1000 from Harvey P. Dale)
Crossrefs
Programs
-
Mathematica
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}]]] Select[Prime[Range[750000]],Times@@IntegerDigits[#]==6&] (* Harvey P. Dale, May 29 2016 *)
-
Python
from sympy import prod, isprime from sympy.utilities.iterables import multiset_permutations def agen(maxdigits): for digs in range(1, maxdigits+1): for mp in multiset_permutations("1"*(digs-1) + "236", digs): if prod(map(int, mp)) == 6: t = int("".join(mp)) if isprime(t): yield t print(list(agen(8))) # Michael S. Branicky, Jun 16 2021