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