OFFSET
1,3
LINKS
Hans Havermann, Table of n, a(n) for n = 1..1512 (terms 1..1000 from Giovanni Resta, terms 1001..1167 from Robert G. Wilson v).
Hans Havermann, pdf file showing the corresponding A350572 terms and illustrating the binary embeddings (for terms 1..1512).
EXAMPLE
101000_10 = 1100010{101000}1000_2.
MATHEMATICA
Select[FromDigits /@ IntegerDigits[Range[2^15]-1, 2], StringPosition[StringJoin @@ (ToString /@ IntegerDigits[#, 2]), ToString@#] != {} &] (* terms < 10^15, Giovanni Resta, Apr 30 2013 *)
f[n_] := Block[{a = FromDigits@ IntegerDigits[n, 2]}, If[ StringPosition[ ToString@ FromDigits@ IntegerDigits[ a, 2], ToString@ a] != {}, a, 0]]; k = 0; lst = {}; While[k < 65, AppendTo[lst, f@k]; lst = Union@ lst; k++]; lst (* Robert G. Wilson v, Jun 29 2014 *)
PROG
(PARI) {for(vv=0, 200, bvv=binary(vv);
mm=length(bvv); texp=0; btod=0;
forstep(i=mm, 1, -1, btod=btod+bvv[i]*10^texp; texp++);
bigb=binary(btod); lbb=length(bigb); swsq=1;
for(k=0, lbb - mm , for(j=1, mm, if(bvv[j]!=bigb[j+k], swsq=0));
if(swsq==1, print1(btod, ", "); break, swsq=1)))}
\\\ Douglas Latimer, Apr 29 2013
(Python)
from itertools import count, islice, product
def ok(n): return int(max(str(n))) < 2 and str(n) in bin(n)
def agen(): # generator of terms
yield 0
for d in count(1):
for rest in product("01", repeat=d-1):
k = int("1" + "".join(rest))
if ok(k):
yield k
print(list(islice(agen(), 35))) # Michael S. Branicky, Jan 04 2022
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Patrick De Geest, Feb 15 1999
STATUS
approved