OFFSET
2,1
COMMENTS
No zeros are allowed in the decimal representation of a(n).
EXAMPLE
a(5) = 14423 since 1^4423+14^423+144^23+1442^3 is prime.
MATHEMATICA
(* first do *) Needs["DiscreteMath`Combinatorica`"] (* then *) f[n_] := Block[{k = (10^n - 1)/9}, While[id = IntegerDigits@k; First@ Union@ id == 0 || !PrimeQ[Plus @@ Table[FromDigits@ Take[id, {1, k}]^FromDigits@ Take[id, {k + 1, n}], {k, n - 1}]], k++ ]; k]; Do[Print[f[n]] // Timing, {n, 2, 7}] (* Robert G. Wilson v, Apr 27 2006 *)
PROG
(Python)
from sympy import isprime
from itertools import product
def a(n):
for p in product("123456789", repeat=n):
s = "".join(p)
if isprime(sum(int(s[:i])**int(s[i:]) for i in range(1, n))):
return int(s)
print([a(n) for n in range(2, 6)]) # Michael S. Branicky, Jun 27 2022
CROSSREFS
KEYWORD
base,more,nonn
AUTHOR
Ray G. Opao, Apr 25 2006
EXTENSIONS
a(6) from Robert G. Wilson v and Farideh Firoozbakht, Apr 27 2006
a(7) from Sean A. Irvine, Dec 15 2009
STATUS
approved