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.

A368842 a(n) gives the number of triples of equally spaced equal digits in the binary expansion of n (without leading zeros).

This page as a plain text file.
%I A368842 #17 Jan 10 2024 12:15:20
%S A368842 0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,2,2,1,0,0,0,1,0,2,1,0,0,0,1,2,2,4,4,2,
%T A368842 2,1,0,0,0,1,2,0,2,1,0,0,2,3,2,1,0,0,0,1,0,2,2,1,2,2,2,3,4,6,6,4,3,2,
%U A368842 2,2,1,2,2,1,1,1,0,1,1,3,3,2,0,0,2,3,1
%N A368842 a(n) gives the number of triples of equally spaced equal digits in the binary expansion of n (without leading zeros).
%C A368842 This sequence diverges to infinity by Van der Waerden's theorem.
%C A368842 A000225 \ {1, 3} corresponds to indices of records.
%H A368842 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A368842 a(2^k) = A002620(k - 1) for any k > 0.
%F A368842 a(2^k - 1) = A002620(k - 1) for any k > 0.
%F A368842 a(n) = A368843(n) + A368844(n).
%F A368842 a(floor(n/2)) <= a(n).
%e A368842 For n = 277:
%e A368842 - the binary expansion of 277 is "100010101",
%e A368842 - we have the following triples:  1   1   1
%e A368842                                    000
%e A368842                                    0 0 0
%e A368842                                      0 0 0
%e A368842                                       1 1 1
%e A368842 - so a(277) = 5.
%o A368842 (PARI) a(n, base=2) = { my (d = digits(n, base), v = 0); for (i = 1, #d-2, forstep (j = i+2, #d, 2, if (d[i]==d[j] && d[i]==d[(i+j)/2], v++;););); return (v); }
%o A368842 (Python)
%o A368842 def A368842(n):
%o A368842     l = len(s:=bin(n)[2:])
%o A368842     return sum(1 for i in range(l-2) for j in range(1,l-i+1>>1) if s[i:i+(j<<1)+1:j] in {'000','111'}) # _Chai Wah Wu_, Jan 10 2024
%Y A368842 Cf. A000225, A002620, A368841, A368843, A368844.
%K A368842 nonn,base,easy
%O A368842 0,16
%A A368842 _Rémy Sigrist_, Jan 07 2024