OFFSET
1,1
COMMENTS
The argument used to prove that A018800(n) always exists applies here also. - N. J. A. Sloane, Nov 14 2014
LINKS
EXAMPLE
4 in binary is 100. Looking at the binary numbers that begin with 100: 100 = 4 in decimal is composite; 1000 = 8 in decimal is composite; 1001 = 9 in decimal is composite; 10000 = 16 in decimal is composite. But 10001 = 17 in decimal is prime. So a(4) = 17.
MAPLE
A164022 := proc(n) dgs2 := convert(n, base, 2) ; ldgs := nops(dgs2) ; for i from 1 do p := ithprime(i) ; if p >= n then pdgs := convert(p, base, 2) ; if [op(nops(pdgs)+1-ldgs.. nops(pdgs), pdgs)] = dgs2 then RETURN( p) ; fi; fi; od: end: seq(A164022(n), n=1..120) ; # R. J. Mathar, Sep 13 2009
MATHEMATICA
With[{s = Map[IntegerDigits[#, 2] &, Prime@ Range[10^4]]}, Table[Block[{d = IntegerDigits[n, 2]}, FromDigits[#, 2] &@ SelectFirst[s, Take[#, UpTo@ Length@ d] == d &]], {n, 64}]] (* Michael De Vlieger, Sep 23 2017 *)
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Aug 08 2009
EXTENSIONS
Corrected terms a(1) and a(2) (with help from Ray Chandler) Leroy Quet, Aug 16 2009
Extended by R. J. Mathar, Sep 13 2009
STATUS
approved