login
Numbers whose binary expansion is a cubefree string.
9

%I #16 May 06 2017 20:46:46

%S 0,1,2,3,4,5,6,9,10,11,12,13,18,19,20,21,22,25,26,27,36,37,38,41,43,

%T 44,45,50,51,52,53,54,73,74,75,76,77,82,83,86,89,90,91,100,101,102,

%U 105,107,108,109,146,147,148,150,153,154,155,164,165,166,172,173,178,179,180,181,182

%N Numbers whose binary expansion is a cubefree string.

%C Cubefree means that there is no substring which is the repetition of three identical nonempty strings, see examples.

%C If n is not in the sequence, no number of the form n*2^k + m with 0 <= m < 2^k can be in the sequence, nor any number of the form m*2^k + n with 2^k > n, m >= 0.

%H Chai Wah Wu, <a href="/A286262/b286262.txt">Table of n, a(n) for n = 1..10000</a>

%F lim a(n)/n = infinity: sequence has asymptotic density 0.

%e 7 is not in the sequence, because 7 = 111[2] contains three consecutive "1"s.

%e 8 is not in the sequence, because 8 = 1000[2] contains three consecutive "0"s.

%e More generally, no number congruent to 7 or congruent to 0 (mod 8) may be in the sequence.

%e Even more generally, no number of the form m*2^(k+3) +- n, n < 2^k, can be in this sequence.

%e 42 is not in the sequence, because 42 = 101010[2] contains three consecutive "10"s.

%e From the comment follows that no number of the form 7*2^k, 8*2^k or 42*2^k may be in the sequence, for any k>=0. More generally, no number of the form 7*2^k + m, 8*2^k + m or 42*2^k + m may be in the sequence, for any 2^k > m >= 0.

%p isCubeFree:=proc(v) local n, L;

%p for n from 3 to nops(v) do for L to n/3 do

%p if v[n-L*2+1 .. n] = v[n-L*3+1 .. n-L] then RETURN(false) fi od od; true end;

%p a:=[];

%p for n from 1 to 512 do

%p if isCubeFree(convert(n, base, 2)) then a:=[op(a), n]; fi; od;

%p a;

%o (Python)

%o from __future__ import division

%o def is_cubefree(s):

%o l = len(s)

%o for i in range(l-2):

%o for j in range(1,(l-i)//3+1):

%o if s[i:i+2*j] == s[i+j:i+3*j]:

%o return False

%o return True

%o A286262_list = [n for n in range(10**4) if is_cubefree(bin(n)[2:])] # _Chai Wah Wu_, May 06 2017

%Y Cf. A028445, A063037, A286261 (complement of this sequence).

%K nonn,base

%O 1,3

%A _M. F. Hasler_, May 05 2017