退出

Maximum length of consecutive square intervals with identical prime counts

数论 Math StackExchange 0 票 1 回答 72 浏览 提问者: Arvind 2026-08-27 10:07
number-theory prime-numbers

问题内容

I am a class 10 student exploring number theory and thinking about variations of famous problems like Legendre's conjecture.Let an interval between consecutive squares be defined for a given integer $n \ge 1$. Let $a_n$ represent the exact count of prime numbers that fall within the interval from $n^2$ to $(n+1)^2$.Suppose we examine sequences of consecutive square intervals that share an identical prime count. We define a sequence of length $k$ as a maximal set of $k$ consecutive values of $n$ for which the prime counts are completely equal:$$a_n = a_{n+1} = a_{n+2} = \dots = a_{n+k-1}$$Based on numerical patterns, my conjecture is that such sequences of identical prime counts can grow arbitrarily large without an upper bound as $n \to \infty$. Furthermore, I am interested in analyzing the frequency distribution of these matching counts across the number line.Accordingly, I would like to pose the following two questions:

Question 1: What is the maximum possible length $k$ of such a sequence of consecutive square intervals sharing identical prime counts, or can $k$ grow without limit as $n$ increases?

Question 2: How frequently do sequences of a specific length $k$ (such as $k = 2, 3, 4, \dots$) occur as $n$ scales?Does this behavior have a known designation in number theory literature, or are there existing frameworks that study these properties? Any insights or references would be greatly appreciated!

(Note: I utilized Gemini to assist in formatting this mathematical inquiry using LaTeX. And also used it to write this in formal way.)

Formal write‑up available on Zenodo: https://doi.org/10.5281/zenodo.22127557

I tested it for $n=1000$

It satisfies this hypothesis for $n=1000$ and thanks to @Amitai for this code.

code:

    for i in range(1,math.floor(math.sqrt(n))+1):
        if n % i == 0 and i != 1:
            return False
    return True

def pattern(n):
    primeCount = 0
    for i in range(n**2, (n+1)**2):
        if isPrime(i):
            primeCount += 1
    return primeCount

def countPattern(n):
    return [pattern(i) for i in range (1,n)]

print(countPattern(1000))

回答 (1)

Amitai 1 票 2026-08-27 12:57 原文

Here's some sample code; change the number at the bottom to extend the range if needed.

def isPrime(n):
    for i in range(1,math.floor(math.sqrt(n))+1):
        if n % i == 0 and i != 1:
            return False
    return True

def pattern(n):
    primeCount = 0
    for i in range(n**2, (n+1)**2):
        if isPrime(i):
            primeCount += 1
    return primeCount

def countPattern(n):
    return [pattern(i) for i in range (1,n)]

print(countPattern(1000))

Running this up to 1000 seems to show that these numbers $a_n$ definitely increase. Prime inequalities would let us confirm the answer a priori, so this isn't a full answer, just me helping you gather data :P