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.

A374179 a(n) is the least prime p such that the binary expansions of p and of the next prime q > p differ at exactly n positions, and p and q have the same binary length.

This page as a plain text file.
%I A374179 #14 Jul 10 2024 15:03:17
%S A374179 2,11,47,139,157,191,1151,1531,3067,7159,20479,36857,49139,98299,
%T A374179 360439,917503,1310719,786431,6291449,5242877,20971507,58720253,
%U A374179 83886053,201326557,335544301,402653171,3489660919,1879048183,5368709117,25769803751,21474836479,77309411323
%N A374179 a(n) is the least prime p such that the binary expansions of p and of the next prime q > p differ at exactly n positions, and p and q have the same binary length.
%e A374179   a(n): 2       11           47               139                157
%e A374179    np   3       13           53               149                163
%e A374179       [1 0]  [1 0 1 1]  [1 0 1 1 1 1]  [1 0 0 0 1 0 1 1]  [1 0 0 1 1 1 0 1]
%e A374179       [1 1]  [1 1 0 1]  [1 1 0 1 0 1]  [1 0 0 1 0 1 0 1]  [1 0 1 0 0 0 1 1]
%e A374179          ^      ^ ^        ^ ^   ^            ^ ^ ^ ^          ^ ^ ^ ^ ^
%e A374179   n:     1       2            3                  4                 5
%o A374179 (Python)
%o A374179 from sympy import nextprime
%o A374179 def A374179(n):
%o A374179     p, pb = 2, 2
%o A374179     while (q:=nextprime(p)):
%o A374179         if pb==(qb:=q.bit_length()) and (p^q).bit_count() == n:
%o A374179             return p
%o A374179         p, pb = q, qb  # _Chai Wah Wu_, Jul 10 2024
%Y A374179 Cf. A000120, A000788, A007088, A061712, A205510, A374178.
%K A374179 nonn,base
%O A374179 1,1
%A A374179 _Hugo Pfoertner_, Jul 09 2024