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.

A368844 a(n) gives the number of triples of equally spaced 0's in the binary expansion of n (without leading zeros).

This page as a plain text file.
%I A368844 #14 Jan 10 2024 12:12:31
%S A368844 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,4,2,
%T A368844 2,1,0,0,0,0,2,0,1,0,0,0,0,0,2,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,6,4,3,2,
%U A368844 2,2,1,1,2,0,1,0,0,0,0,0,3,2,0,0,1,1,0
%N A368844 a(n) gives the number of triples of equally spaced 0's in the binary expansion of n (without leading zeros).
%H A368844 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A368844 a(2*n) >= a(n).
%F A368844 a(2*n + 1) = a(n).
%e A368844 For n = 277:
%e A368844 - the binary expansion of 277 is "100010101",
%e A368844 - we have the following triples:   000
%e A368844                                    0 0 0
%e A368844                                      0 0 0
%e A368844 - so a(277) = 3.
%o A368844 (PARI) a(n, t = 0, base = 2) = { my (d = digits(n, base), v = 0); for (i = 1, #d-2, if (d[i]==t, forstep (j = i+2, #d, 2, if (d[i]==d[j] && d[i]==d[(i+j)/2], v++;);););); return (v); }
%o A368844 (Python)
%o A368844 def A368844(n):
%o A368844     l = len(s:=bin(n)[3:])
%o A368844     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]=='000') # _Chai Wah Wu_, Jan 10 2024
%Y A368844 Cf. A368842, A368843.
%K A368844 nonn,base,easy
%O A368844 0,17
%A A368844 _Rémy Sigrist_, Jan 07 2024