cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A343701 Prime numbers such that the product of their digits equals twice the number of their digits times the sum of their digits.

This page as a plain text file.
%I A343701 #17 Jun 30 2023 16:32:23
%S A343701 347,743,15581,42451,51581,54421,58151,58511,81551,112583,115823,
%T A343701 118253,121853,122443,123581,125183,125813,128153,128351,132851,
%U A343701 135281,138251,144223,152183,152381,153281,158231,181253,181523,185123,211583,214243,215183,215381,218513,218531,223441,235181,235811,238151,242413
%N A343701 Prime numbers such that the product of their digits equals twice the number of their digits times the sum of their digits.
%H A343701 Michael S. Branicky, <a href="/A343701/b343701.txt">Table of n, a(n) for n = 1..10000</a>
%e A343701 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.
%p A343701 q:= n-> (l-> mul(i,i=l)=2*nops(l)*add(i,i=l))(convert(n, base, 10)):
%p A343701 select(q, [ithprime(j)$j=1..100000])[];  # _Alois P. Heinz_, May 30 2021
%t A343701 Select[Range[1000000], PrimeQ[#] && Times@@IntegerDigits[#] == 2 Length[IntegerDigits[#]] Total[IntegerDigits[#]] &]
%t A343701 Select[Prime[Range[22000]],Times@@IntegerDigits[#]==2(IntegerLength[#]Total[ IntegerDigits[ #]])&] (* _Harvey P. Dale_, Jun 30 2023 *)
%o A343701 (Python)
%o A343701 from math import prod
%o A343701 from sympy import isprime
%o A343701 from sympy.utilities.iterables import multiset_permutations as mp
%o A343701 from itertools import count, islice, combinations_with_replacement as mc
%o A343701 def c(s):
%o A343701     d = list(map(int, s))
%o A343701     return prod(d) == 2*len(d)*sum(d)
%o A343701 def agen():
%o A343701     for d in count(2):
%o A343701         okset = set()
%o A343701         for cand in ("".join(m) for m in mc("987654321", d)):
%o A343701             if c(cand):
%o A343701                 for p in mp(cand, d):
%o A343701                     t = int("".join(p))
%o A343701                     if isprime(t): okset.add(t)
%o A343701         yield from sorted(okset)
%o A343701 print(list(islice(agen(), 41))) # _Michael S. Branicky_, Nov 30 2022
%Y A343701 Cf. A064155.
%K A343701 nonn,base
%O A343701 1,1
%A A343701 _Tanya Khovanova_, May 26 2021