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.

A374178 a(n) is the least prime p such that p and the next prime > p have exactly n common 1's in their binary expansion.

Original entry on oeis.org

2, 5, 19, 29, 181, 359, 379, 983, 3821, 3581, 8179, 16111, 81901, 98297, 131059, 131063, 524269, 917471, 3145679, 4128763, 16744423, 16776187, 58720223, 117440381, 266330047, 468713467, 536870879, 1073741309, 2147483629, 4294967231, 8589410287, 33285865469
Offset: 1

Views

Author

Hugo Pfoertner, Jul 08 2024

Keywords

Comments

1

Examples

			  a(n): 2       5         19           29              181
   np   3       7         23           31              191
      [1 0]  [1 0 1]  [1 0 0 1 1]  [1 1 1 0 1]  [1 0 1 1 0 1 0 1]
      [1 1]  [1 1 1]  [1 0 1 1 1]  [1 1 1 1 1]  [1 0 1 1 1 1 1 1]
       ^      ^   ^    ^     ^ ^    ^ ^ ^   ^    ^   ^ ^   ^   ^
  n:   1        2          3            4               5
		

Crossrefs

Programs

  • Python
    from sympy import nextprime
    def A374178(n):
        p = 2
        while (q:=nextprime(p)):
            if (p&q).bit_count() == n:
                return p
            p = q # Chai Wah Wu, Jul 08 2024