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.

This page as a plain text file.
%I A374178 #18 Jul 09 2024 11:57:31
%S A374178 2,5,19,29,181,359,379,983,3821,3581,8179,16111,81901,98297,131059,
%T A374178 131063,524269,917471,3145679,4128763,16744423,16776187,58720223,
%U A374178 117440381,266330047,468713467,536870879,1073741309,2147483629,4294967231,8589410287,33285865469
%N 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.
%C A374178 1
%H A374178 Alois P. Heinz, <a href="/A374178/b374178.txt">Table of n, a(n) for n = 1..100</a>
%e A374178   a(n): 2       5         19           29              181
%e A374178    np   3       7         23           31              191
%e A374178       [1 0]  [1 0 1]  [1 0 0 1 1]  [1 1 1 0 1]  [1 0 1 1 0 1 0 1]
%e A374178       [1 1]  [1 1 1]  [1 0 1 1 1]  [1 1 1 1 1]  [1 0 1 1 1 1 1 1]
%e A374178        ^      ^   ^    ^     ^ ^    ^ ^ ^   ^    ^   ^ ^   ^   ^
%e A374178   n:   1        2          3            4               5
%o A374178 (Python)
%o A374178 from sympy import nextprime
%o A374178 def A374178(n):
%o A374178     p = 2
%o A374178     while (q:=nextprime(p)):
%o A374178         if (p&q).bit_count() == n:
%o A374178             return p
%o A374178         p = q # _Chai Wah Wu_, Jul 08 2024
%Y A374178 Cf. A000120, A000788, A007088, A061712, A205510.
%K A374178 nonn,base
%O A374178 1,1
%A A374178 _Hugo Pfoertner_, Jul 08 2024