login
A090840
Smallest prime whose product of digits is 5^n.
6
11, 5, 11551, 15551, 1551551, 15551551, 1155555151, 1555551551, 11555555551, 1155155555551, 555555515551, 555555555551, 5555555555551, 555155555555551, 51555555551555551, 51555555555555551, 1155555555555555551, 15551555555555555551, 1155515555555555555551
OFFSET
0,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..998
EXAMPLE
a(4) = 1551551 because its digital product is 5^4, and it is prime.
MAPLE
a:= proc(n) local k, t; for k from 0 do t:= min(select(isprime,
map(x-> parse(cat(x[])), combinat[permute]([1$k, 5$n]))));
if t<infinity then return t fi od
end:
seq(a(n), n=0..18); # Alois P. Heinz, Nov 05 2021
MATHEMATICA
NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; a = Table[0, {18}]; p = 2; Do[q = Log[5, Times @@ IntegerDigits[p]]; If[q != 0 && IntegerQ[q] && a[[q]] == 0, a[[q]] = p; Print[q, " = ", p]]; p = NextPrim[p], {n, 1, 10^9}]
For a(13); a = Map[ FromDigits, Permutations[{1, 1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}]]; Min[ Select[a, PrimeQ[ # ] &]]
PROG
(Python)
from sympy import isprime
from sympy.utilities.iterables import multiset_permutations as mp
def a(n):
if n < 2: return [11, 5][n]
digits = n + 1
while True:
for p in mp("1"*(digits-n-1) + "5"*n, digits-1):
t = int("".join(p) + "1")
if isprime(t): return t
digits += 1
print([a(n) for n in range(19)]) # Michael S. Branicky, Nov 05 2021
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Robert G. Wilson v, Dec 09 2003
EXTENSIONS
a(17) and beyond from Michael S. Branicky, Nov 05 2021
STATUS
approved