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.

Showing 1-3 of 3 results.

A368843 a(n) gives the number of triples of equally spaced 1's in the binary expansion of n.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0, 0, 1, 2, 2, 4, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 2, 3, 0, 0, 0, 0, 0, 1, 0, 2, 1, 1, 2, 2, 2, 3, 4, 6, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 3, 0, 0, 0, 0, 1, 2, 1
Offset: 0

Views

Author

Rémy Sigrist, Jan 07 2024

Keywords

Examples

			For n = 277:
- the binary expansion of 277 is "100010101",
- we have the following triples:  1   1   1
                                      1 1 1
- so a(277) = 2.
		

Crossrefs

Programs

  • PARI
    a(n, t = 1, 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); }
    
  • Python
    def A368843(n):
        l = len(s:=bin(n)[2:])
        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]=='111') # Chai Wah Wu, Jan 10 2024

Formula

a(2*n) = a(n).
a(2*n + 1) >= a(n).

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

Original entry on oeis.org

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, 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, 2, 2, 1, 1, 2, 0, 1, 0, 0, 0, 0, 0, 3, 2, 0, 0, 1, 1, 0
Offset: 0

Views

Author

Rémy Sigrist, Jan 07 2024

Keywords

Examples

			For n = 277:
- the binary expansion of 277 is "100010101",
- we have the following triples:   000
                                   0 0 0
                                     0 0 0
- so a(277) = 3.
		

Crossrefs

Programs

  • 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); }
    
  • Python
    def A368844(n):
        l = len(s:=bin(n)[3:])
        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

Formula

a(2*n) >= a(n).
a(2*n + 1) = a(n).

A368841 Nonnegative integers whose binary expansions (without leading zeros) have no three equally spaced equal digits.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 18, 19, 20, 22, 25, 26, 27, 36, 37, 38, 41, 44, 45, 50, 51, 52, 54, 76, 82, 83, 90, 100, 101, 102, 108, 153, 165, 204
Offset: 1

Views

Author

Rémy Sigrist, Jan 07 2024

Keywords

Comments

Also numbers k such that A368842(k) = 0.
Also numbers k such that A368857(k) < 3.
This sequence is finite by Van der Waerden's theorem.

Crossrefs

Programs

  • PARI
    is(n, base = 2) = { my (d = digits(n, base)); for (i = 1, #d-2, forstep (j = i+2, #d, 2, if (d[i]==d[j] && d[i]==d[(i+j)/2], return (0);););); return (1); }
Showing 1-3 of 3 results.