OFFSET
2,1
LINKS
Michael De Vlieger, Table of n, a(n) for n = 2..16384
EXAMPLE
9 in binary is 1001. Putting a 0 after the first 1 results in 10001, which is 17 in decimal. Putting a 0 after the last 1 results in 10010, which is 18 in decimal. 17 is < 18, but 17 is prime. So a(9) = 18, a composite.
MAPLE
rebase := proc(L, b) add( op(i, L)*b^(i-1), i=1..nops(L)) ; end proc: A164702 := proc(n) local bdg, a, p, bplu, newa ; bdg := convert(n, base, 2) ; a := -1 ; for p from 1 to nops(bdg) do if op(p, bdg) = 1 then bplu := [op(1..p-1, bdg), 0, op(p..nops(bdg), bdg)] ; newa := rebase(bplu, 2) ; if newa > 3 and not isprime(newa) then if a = -1 or newa < a then a := newa ; end if; end if; end if; end do ; return a ; end proc: seq(A164702(n), n=2..100) ; # R. J. Mathar, Feb 27 2010
MATHEMATICA
Table[With[{d = IntegerDigits[n, 2]}, SelectFirst[Map[FromDigits[#, 2] &@ Insert[d, 0, # + 1] &, Position[d, 1]], CompositeQ]], {n, 2, 70}] (* Michael De Vlieger, Sep 03 2017 *)
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Aug 22 2009
EXTENSIONS
Terms beyond a(13) from R. J. Mathar, Feb 27 2010
STATUS
approved