login
A396279
Integers k such that p - k = floor(log_2(k)), where p is the smallest prime strictly greater than k.
4
2, 5, 8, 14, 19, 25, 32, 48, 54, 62, 73, 83, 91, 121, 142, 184, 204, 216, 244, 285, 299, 323, 339, 359, 389, 401, 411, 423, 449, 471, 479, 491, 512, 532, 548, 578, 622, 632, 664, 692, 710, 778, 788, 800, 812, 830, 844, 868, 898, 920, 958, 1000, 1022, 1039, 1051
OFFSET
1,1
EXAMPLE
For a(3) = 8: The smallest prime > 8 is 11. The distance to the next prime is 11 - 8 = 3. The base-2 scale is floor(log2(8)) = 3. Because the gap (3) equals the scale (3), 8 is included.
For a(7) = 32: The smallest prime > 32 is 37. The distance to the next prime is 37 - 32 = 5. The base-2 scale is floor(log2(32)) = 5. Because the gap (5) equals the scale (5), 32 is included.
MAPLE
q:= k-> nextprime(k)-k=ilog2(k):
select(q, [$1..1070])[]; # Alois P. Heinz, May 23 2026
MATHEMATICA
Select[Range[1100], NextPrime[#] == # + Floor[Log2[#]] &] (* Amiram Eldar, May 22 2026 *)
PROG
(Python)
import math
import sympy
def generate_boundary_numbers(limit):
# These lines must be indented by 4 spaces
boundary_numbers = []
n = 2
while len(boundary_numbers) < limit:
# These lines are inside 'while', so they need 8 spaces
next_p = sympy.nextprime(n)
gap = next_p - n
scale = int(math.log2(n))
if gap == scale:
# This line is inside 'if', so it needs 12 spaces
boundary_numbers.append(n)
n += 1
return boundary_numbers
# This is outside the function, so it has 0 spaces
print(generate_boundary_numbers(50))
(PARI) isok(k) = nextprime(k+1) - k == log(k)\log(2); \\ Michel Marcus, May 21 2026
CROSSREFS
Cf. A000040 (primes), A000523 (floor(log2)), A151800 (next prime), A396203, A396282.
Sequence in context: A190105 A295400 A266287 * A111711 A095348 A215725
KEYWORD
nonn
AUTHOR
Sajid Hussain, May 21 2026
STATUS
approved