login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A064155 Let p = x1x2x3...xk be a prime in base 10 with k digits. The sequence gives the primes p such that x1*x2*x3*...xk = k*(x1 + x2 + x3 + ... + xk). 2
2, 3, 5, 7, 167, 523, 617, 761, 1427, 2417, 2741, 4127, 4217, 4271, 4721, 126241, 126421, 146221, 212461, 216421, 221461, 224611, 226141, 241261, 242161, 246121, 261241, 262411, 264211, 421621, 426211, 621241, 642121, 642211, 1111457, 1111547, 1115417, 1117451 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000 (terms 1..100 from Harry J. Smith)
EXAMPLE
167 belongs to the sequence because 1*6*7 = 42 and 3*(1+6+7) = 42.
MATHEMATICA
Select[Prime@Range@1000000, Plus@@(i=IntegerDigits@#)*Length@i == Times@@i&] (*Hans Rudolf Widmer, Jun 13 2024*)
PROG
(PARI) ProdD(x)= { local(p); p=1; while (x>9 && p>0, p*=(x-10*(x\10)); x\=10); return(p*x) }
SumD(x)= { local(s); s=0; while (x>9, s+=x-10*(x\10); x\=10); return(s + x) }
digitsIn(x)= { local(d); if (x==0, return(1)); d=1 + log(x)\log(10); if (10^d == x, d++, if (10^(d-1) > x, d--)); return(d) }
{ n=r=0; for (m=1, 10^9, r=nextprime(r+1); if ((p=ProdD(r)) && p == digitsIn(r)*SumD(r), write("b064155.txt", n++, " ", r); if (n==100, break)) ) } \\ Harry J. Smith, Sep 09 2009
(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) == len(d)*sum(d)
def agen():
yield from (2, 3, 5, 7)
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(), 38))) # Michael S. Branicky, Nov 30 2022
CROSSREFS
Sequence in context: A281021 A230046 A098463 * A230047 A230042 A230045
KEYWORD
easy,nonn,base
AUTHOR
Felice Russo, Sep 14 2001
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 14 09:10 EDT 2024. Contains 375159 sequences. (Running on oeis4.)