login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Numbers whose binary expansion is quasiperiodic.
4

%I #27 Oct 04 2023 17:22:31

%S 3,7,10,15,21,31,36,42,45,54,63,73,85,91,109,127,136,146,153,170,173,

%T 181,182,187,204,219,221,238,255,273,292,307,341,365,375,409,438,443,

%U 477,511,528,546,561,585,594,614,627,660,682,685,693,725,726,731,750

%N Numbers whose binary expansion is quasiperiodic.

%C The binary representation of a term (ignoring leading zeros) can be covered by (possibly overlapping) occurrences of one of its proper prefix.

%C This sequence contains A121016.

%C For any k > 0, there are A320434(k)/2 terms with binary length k.

%H Michael S. Branicky, <a href="/A320441/b320441.txt">Table of n, a(n) for n = 1..10000</a>

%H Rémy Sigrist, <a href="/A320441/a320441.png">Scatterplot of the first difference of the first 100000 terms</a>

%F A020330(a(n)) belongs to the sequence for any n > 0.

%F A297405(a(n)) belongs to the sequence for any n > 0.

%e The first terms, alongside their binary representations and prefixes, are:

%e n a(n) bin(a(n)) prefix

%e -- ---- --------- ------

%e 1 3 11 1

%e 2 7 111 1

%e 3 10 1010 10

%e 4 15 1111 1

%e 5 21 10101 101

%e 6 31 11111 1

%e 7 36 100100 100

%e 8 42 101010 10

%e 9 45 101101 101

%e 10 54 110110 110

%e 11 63 111111 1

%e 12 73 1001001 1001

%o (PARI) isok(w) = { my (tt=0); for (l=1, oo, my (t=w%(2^l)); if (t!=tt, if (t==w, return (0)); my (r=w, g=l); while (g-->=0 && r>=t, r \= 2; if (r%(2^l)==t, if (r==t, return (1), g=l))); tt = t)) }

%o (Python)

%o def qp(w):

%o for i in range(1, len(w)):

%o prefix, covered = w[:i], set()

%o for j in range(len(w)-i+1):

%o if w[j:j+i] == prefix:

%o covered |= set(range(j, j+i))

%o if covered == set(range(len(w))):

%o return True

%o return False

%o def ok(n): return qp(bin(n)[2:])

%o print([k for k in range(751) if ok(k)]) # _Michael S. Branicky_, Mar 20 2022

%Y Cf. A020330, A121016, A297405, A320434.

%K nonn,base

%O 1,1

%A _Rémy Sigrist_, Jan 09 2019