|
|
A168588
|
|
Smallest p(n)-digit prime with digit sum n, and made up of digits 0 and 1 only, where p(n)=A000040(n) (or 0, if no such prime exists).
|
|
1
|
|
|
0, 101, 0, 1011001, 10000110011, 0, 10000000010101111, 1000000000001111111, 0, 10000000000000000101101111101, 1000000000000000000011111110111, 0, 10000000000000000000000000011111111110101, 1000000000000000000000000000110111111011111
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
a(3n) = 0.
|
|
LINKS
|
|
|
MAPLE
|
g:= proc(L) local i, m;
m:= -1;
for i from 1 do
if L[i] = 1 then
if m = -1 then m:= i fi;
if L[i+1] = 0 then
return [1$(i-m), 0$(m-1), 0, 1, op(L[i+2..-1])]
fi
fi
od
end proc:
f:= proc(n) local L, x, pn, i;
if n mod 3 = 0 then return 0 fi;
pn:= ithprime(n);
L:= [1$(n-1), 0$(pn-n), 1];
do
x:= add(L[i]*10^(i-1), i=1..pn);
if isprime(x) then return x fi;
L:= g(L);
od
end proc:
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|