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
KEYWORD
nonn
AUTHOR
Sajid Hussain, May 21 2026
STATUS
approved
