|
|
A236036
|
|
a(n) is the smallest (2n+1)-digit prime number whose central digit equals the sum of its other digits.
|
|
1
|
|
|
10513, 1005013, 100040201, 10000400021, 1000004000111, 100000040002001, 10000000400000111, 1000000004000100011, 100000000040000000021, 10000000000400010000011, 1000000000004000000000111, 100000000000040000010000101, 10000000000000400000000011001
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
2,1
|
|
COMMENTS
|
Sequence starts at n=2, since no such 3-digit prime exists.
|
|
LINKS
|
|
|
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
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|