cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A168586 Smallest n-digit prime with only digits 0 and 1, and having least digit sum (or 0, if no such prime exists).

This page as a plain text file.
%I A168586 #7 Aug 04 2020 01:57:27
%S A168586 0,11,101,0,10111,101111,1011001,10010101,101001001,1000001011,
%T A168586 10000001101,100000010101,1000100000101,10000000001011,
%U A168586 100000000100101,1000000000100011,10000000000001101,100000000001010001,1000000000000010011
%N A168586 Smallest n-digit prime with only digits 0 and 1, and having least digit sum (or 0, if no such prime exists).
%H A168586 Robert Israel, <a href="/A168586/b168586.txt">Table of n, a(n) for n = 1..800</a>
%p A168586 f:= proc(n) local s, c, i,Cands;
%p A168586   for s from 2 to n do
%p A168586     if s mod 3 = 0 then next fi;
%p A168586     Cands:= sort(map(t -> 1 + 10^(n-1) + add(10^t[i],i=1..s-2), combinat:-choose([$1..n-2],s-2)));
%p A168586     for c in Cands do if isprime(c) then return c fi od
%p A168586   od;
%p A168586   0
%p A168586 end proc:
%p A168586 map(f, [$1..20]); # _Robert Israel_, Aug 03 2020
%Y A168586 Cf. A168587, A062339.
%K A168586 nonn,base
%O A168586 1,2
%A A168586 _Lekraj Beedassy_, Nov 30 2009
%E A168586 Extended by _Ray Chandler_, Dec 03 2009