login
A215559
Smallest n-digit noncomposite number (written in base 2) with maximum base-2 digit sum.
1
1, 11, 111, 1011, 11111, 101111, 1111111, 10111111, 101111111, 1111011111, 11111110111, 110111111111, 1111111111111, 11101111111111, 100111111111111, 1111011111111111, 11111111111111111, 111011111111111111, 1111111111111111111, 10111111111111111111
OFFSET
1,2
COMMENTS
In base 10: 1, 3, 7, 11, 31, 47, 127, 191, 383, 991,...
MAPLE
A215559 := proc(n)
local ds, a, k;
ds := 0 ;
a := 0 ;
for k from 2^(n-1) to 2^n-1 do
if isprime(k) or k = 1 then
if A000120(k) > ds then
ds := A000120(k) ;
a := A007088(k) ;
end if;
end if;
end do:
a ;
end proc: # R. J. Mathar, Aug 23 2012
PROG
(PARI) A215559(n)={my(p=2^n-1); !for(d=0, n-2, forvec(v=vector(d, k, [2, n]), isprime(p-sum(i=1, d, 2^(n-v[i])))|next; return(10^n\9-sum(i=1, d, 10^(n-v[i]))), 2))} \\ - M. F. Hasler, Aug 25 2012
CROSSREFS
Sequence in context: A267051 A101680 A267356 * A346231 A164553 A355280
KEYWORD
nonn,base
AUTHOR
Gerasimov Sergey, Aug 16 2012
EXTENSIONS
Corrected by R. J. Mathar, Aug 23 2012
Values double-checked by M. F. Hasler, Aug 25 2012
STATUS
approved