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.

A164702 Write n in binary. Insert one 0 right of any one 1. a(n) is the smallest possible composite equal to the value of any such resulting binary number.

Original entry on oeis.org

4, 6, 8, 9, 10, 14, 16, 18, 18, 21, 20, 21, 22, 27, 32, 33, 34, 35, 36, 42, 38, 39, 40, 49, 42, 51, 44, 45, 46, 55, 64, 65, 66, 69, 68, 69, 70, 75, 72, 81, 74, 75, 76, 77, 78, 87, 80, 81, 82, 99, 84, 85, 86, 87, 88, 105, 90, 91, 92, 93, 94, 95, 128, 129, 130, 133, 132, 133, 134
Offset: 2

Views

Author

Leroy Quet, Aug 22 2009

Keywords

Examples

			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.
		

Programs

  • 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 *)

Extensions

Terms beyond a(13) from R. J. Mathar, Feb 27 2010