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.

A166535 Positive integers whose binary representation does not contain a run of more than three consecutive 0's or 1's.

This page as a plain text file.
%I A166535 #18 Jul 22 2025 07:26:06
%S A166535 1,2,3,4,5,6,7,8,9,10,11,12,13,14,17,18,19,20,21,22,23,24,25,26,27,28,
%T A166535 29,34,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,53,54,55,56,57,
%U A166535 58,59,68,69,70,71,72,73,74,75,76,77,78,81,82,83,84,85,86,87,88,89,90
%N A166535 Positive integers whose binary representation does not contain a run of more than three consecutive 0's or 1's.
%C A166535 A179970 is a subsequence. - _Reinhard Zumkeller_, Aug 04 2010
%C A166535 There are A000073(n+2) terms with binary length n. - _Rémy Sigrist_, Sep 30 2022
%H A166535 R. Zumkeller, <a href="/A166535/b166535.txt">Table of n, a(n) for n = 1..10000</a>
%F A166535 It appears (but has not yet been proved) that the terms of a(n) can be computed recursively as follows. Let {c(i)} be defined for i >= 5 by c(i)=2c(i-1)+1 if i is congruent to 2 mod 4, else c(i)=2c(i-1)-1. I.e., {c(i)}={1,3,5,9,17,35,...} for i=5,6,7,... . Let a(n)=n for n=1,2,...,7. For n>7, choose k so that s(k) < n < s(k+1), where s(k) = Sum_{j=3..k} t(j) with t(j) being the j-th term of the tribonacci sequence A000073 (with initial terms t(0)=0, t(1)=0, t(2)=1). Then a(n) = c(k) + 2a(s(k)) - a(2s(k)+1). This has been verified for n up to 2400.
%F A166535 {i: A043276(i) <= 3}. - _R. J. Mathar_, Jun 04 2021
%t A166535 Select[Range[100],Max[Length/@Split[IntegerDigits[#,2]]]<4&] (* _Harvey P. Dale_, Aug 01 2020 *)
%o A166535 (PARI) tribonacci(n) = ([0,1,0; 0,0,1; 1,1,1]^n)[2,1]
%o A166535 a(n) = { if (n<=4, return (n), my (s=1); for (i=1, oo, my (f=tribonacci(i+2)); i
%o A166535 f (n<s+f, return (2^i-1-a(2*s-n-1)), s+=f))) } \\ _Rémy Sigrist_, Sep 30 2022
%Y A166535 Cf. A000073, A063037, A000975.
%K A166535 nonn
%O A166535 1,2
%A A166535 _John W. Layman_, Oct 16 2009