login
A168586
Smallest n-digit prime with only digits 0 and 1, and having least digit sum (or 0, if no such prime exists).
3
0, 11, 101, 0, 10111, 101111, 1011001, 10010101, 101001001, 1000001011, 10000001101, 100000010101, 1000100000101, 10000000001011, 100000000100101, 1000000000100011, 10000000000001101, 100000000001010001, 1000000000000010011
OFFSET
1,2
LINKS
MAPLE
f:= proc(n) local s, c, i, Cands;
for s from 2 to n do
if s mod 3 = 0 then next fi;
Cands:= sort(map(t -> 1 + 10^(n-1) + add(10^t[i], i=1..s-2), combinat:-choose([$1..n-2], s-2)));
for c in Cands do if isprime(c) then return c fi od
od;
0
end proc:
map(f, [$1..20]); # Robert Israel, Aug 03 2020
CROSSREFS
Sequence in context: A290861 A266515 A036929 * A330290 A330291 A318647
KEYWORD
nonn,base
AUTHOR
Lekraj Beedassy, Nov 30 2009
EXTENSIONS
Extended by Ray Chandler, Dec 03 2009
STATUS
approved