OFFSET
2,1
COMMENTS
Sequence starts at n=2, since no such 3-digit prime exists.
LINKS
Giovanni Resta, Table of n, a(n) for n = 2..100
EXAMPLE
a(3) = 1005013 because the central digit 5 equals the sum of the other digits 1+0+0+0+1+3.
MAPLE
with(numtheory):for n from 2 to 10 do:m:=2*n-2:ii:=1:ii:=0:for k from 10^m to 10^(m+1)-1 while(ii=0)do:x:=convert(k, base, 10):n1:=nops(x):s:=sum('x[j]', 'j'=1..n1):s1:=s-x[n]:if x[n]=s1 and type(k, prime)=true then ii:=1: printf ( "%d %d \n", n, k):else fi:od:od:
MATHEMATICA
a[n_] := Catch@Block[{p}, Do[p = Select[ Union[ FromDigits /@ Flatten[ Permutations /@ (IntegerPartitions[d + n - 1, {n}, Range@d] - 1), 1]] + d*10^n + 10^(2*n), PrimeQ, 1]; If[p != {}, Throw@p[[1]]], {d, {4, 5}}]]; a /@ Range[2, 14] (* Giovanni Resta, Jan 20 2014 *)
PROG
(PARI) isspecial(p, n) = {d = digits(p); s = sumdigits(p); d[n+1] == (s - d[n+1]); }
a(n) = {forprime (p = 10^(2*n), 10^(2*n+1), if (isspecial(p, n), return (p)); ); return (0); } \\ Michel Marcus, Jan 19 2014
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Michel Lagneau, Jan 18 2014
EXTENSIONS
a(9)-a(14) from Giovanni Resta, Jan 20 2014
Name simplified by Jon E. Schoenfield, Sep 09 2017
STATUS
approved