🕷️ Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 199 (from laksa125)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

ℹ️ Skipped - page is already crawled

📄
INDEXABLE
CRAWLED
18 days ago
🤖
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0.6 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://mathoverflow.net/questions/467399/on-hashing-prime-numbers-into-prime-number-of-buckets
Last Crawled2026-04-02 04:23:51 (18 days ago)
First Indexed2024-03-21 04:21:46 (2 years ago)
HTTP Status Code200
Meta Titlent.number theory - On hashing prime numbers into prime number of buckets - MathOverflow
Meta Descriptionnull
Meta Canonicalnull
Boilerpipe Text
Let $b$ be any prime. Consider a set of $b-1$ buckets. Consider all prime numbers (except $b$ ) up to some $N$ . Let us do the simple hash wherein each prime $x$ less than $N$ is assigned to the $x \bmod b$ -th bucket. It is found that as $N$ increases, the number of primes getting assigned to the $b-1$ buckets get very close to each other very rapidly. Can this rapid reduction in the range of numbers of primes hashing to each bucket be quantified as a function of $N$ and $b$ ? Note: If $b$ is not a prime, then, some of the buckets do not receive any of the primes (for example, if $b = 8$ , for any prime $x$ , $x \bmod 8$ can never be $2$ and bucket number $2$ remains empty) but even then, those buckets with non-zero numbers of primes tend to have very nearly equal numbers of primes (from the comment below from Pedraig O'Cathain, I understand, the numbers of primes in each bucket getting close follows from the 'prime number theorem for arithmetic progressions'). Consider the special case $b =7$ and a specific value of the remainder, say $3$ . Only for those primes that gave hash value (remainder) $3$ , we looked at the buckets into which the next higher prime would go. It was found that for primes immediately greater than those that hash to $3$ , their distribution among the buckets is always uneven (i.e., if a prime hashes to $3$ , the next prime is not equally likely to hash to each possible value $1$ to $6$ ) and never seems to equalize among the buckets even if we go to very large $N$ . If bucket $b_i$ gets more primes than bucket $b_j$ for some value of $N$ , then $b_i$ continues to get more primes for larger values of $N$ ; however, the ratio of number of primes in $b_i$ to number in $b_j$ reduces with $N$ but never quite gets to $1$ it seems. Have these phenomena been quantified? Note: Also checked numerically the buckets to which the second prime after a prime that hashes to bucket 3 goes. Now, the range of probabilities among the 6 possible buckets is much reduced but for even fairly large N, they don't quite equalize. Is there some hash function for primes that has the property: if any prime hashes to a particular bucket, the next higher prime is equally likely to hash to any of the buckets?
Markdown
[Skip to main content](https://mathoverflow.net/questions/467399/on-hashing-prime-numbers-into-prime-number-of-buckets#content) #### Stack Exchange Network Stack Exchange network consists of 183 Q\&A communities including [Stack Overflow](https://stackoverflow.com/), the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. [Visit Stack Exchange](https://stackexchange.com/) 1. - [Tour Start here for a quick overview of the site](https://mathoverflow.net/tour) - [Help Center Detailed answers to any questions you might have](https://mathoverflow.net/help) - [Meta Discuss the workings and policies of this site](https://meta.mathoverflow.net/) - [About Us Learn more about Stack Overflow the company, and our products](https://stackoverflow.co/) 2. ### [current community](https://mathoverflow.net/) - [MathOverflow](https://mathoverflow.net/) [help](https://mathoverflow.net/help) [chat](https://chat.stackexchange.com/?tab=site&host=mathoverflow.net) - [MathOverflow Meta](https://meta.mathoverflow.net/) ### your communities [Sign up](https://mathoverflow.net/users/signup?ssrc=site_switcher&returnurl=https%3A%2F%2Fmathoverflow.net%2Fquestions%2F467399%2Fon-hashing-prime-numbers-into-prime-number-of-buckets) or [log in](https://mathoverflow.net/users/login?ssrc=site_switcher&returnurl=https%3A%2F%2Fmathoverflow.net%2Fquestions%2F467399%2Fon-hashing-prime-numbers-into-prime-number-of-buckets) to customize your list. ### [more stack exchange communities](https://stackexchange.com/sites) [company blog](https://stackoverflow.blog/) 3. [Log in](https://mathoverflow.net/users/login?ssrc=head&returnurl=https%3A%2F%2Fmathoverflow.net%2Fquestions%2F467399%2Fon-hashing-prime-numbers-into-prime-number-of-buckets) 4. [Sign up](https://mathoverflow.net/users/signup?ssrc=head&returnurl=https%3A%2F%2Fmathoverflow.net%2Fquestions%2F467399%2Fon-hashing-prime-numbers-into-prime-number-of-buckets) [![MathOverflow](https://mathoverflow.net/Content/Sites/mathoverflow/Img/logo.svg?v=3a674b060adf)](https://mathoverflow.net/) 1. 1. [Home](https://mathoverflow.net/) 2. [Questions](https://mathoverflow.net/questions) 3. [Unanswered](https://mathoverflow.net/unanswered) 4. [AI Assist](https://stackoverflow.com/ai-assist) 5. [Tags](https://mathoverflow.net/tags) 6. [Chat](https://chat.stackexchange.com/) 7. [Users](https://mathoverflow.net/users) # [On hashing prime numbers into prime number of buckets](https://mathoverflow.net/questions/467399/on-hashing-prime-numbers-into-prime-number-of-buckets) [Ask Question](https://mathoverflow.net/questions/ask) Asked 2 years ago Modified [2 years ago](https://mathoverflow.net/questions/467399/on-hashing-prime-numbers-into-prime-number-of-buckets?lastactivity "2024-03-28 14:33:54Z") Viewed 190 times 0 \$\\begingroup\$ Let \$b\$ be any prime. Consider a set of \$b-1\$ buckets. Consider all prime numbers (except \$b\$) up to some \$N\$. Let us do the simple hash wherein each prime \$x\$ less than \$N\$ is assigned to the \$x \\bmod b\$\-th bucket. 1. It is found that as \$N\$ increases, the number of primes getting assigned to the \$b-1\$ buckets get very close to each other very rapidly. Can this rapid reduction in the *range* of numbers of primes hashing to each bucket be quantified as a function of \$N\$ and \$b\$? Note: If \$b\$ is not a prime, then, some of the buckets do not receive any of the primes (for example, if \$b = 8\$, for any prime \$x\$, \$x \\bmod 8\$ can never be \$2\$ and bucket number \$2\$ remains empty) but even then, those buckets with non-zero numbers of primes tend to have very nearly equal numbers of primes (from the comment below from Pedraig O'Cathain, I understand, the numbers of primes in each bucket getting close follows from the 'prime number theorem for arithmetic progressions'). 1. Consider the special case \$b =7\$ and a specific value of the remainder, say \$3\$. Only for those primes that gave hash value (remainder) \$3\$, we looked at the buckets into which the next higher prime would go. It was found that for primes immediately greater than those that hash to \$3\$, their distribution among the buckets is always uneven (i.e., if a prime hashes to \$3\$, the next prime is not equally likely to hash to each possible value \$1\$ to \$6\$) and never seems to equalize among the buckets even if we go to very large \$N\$. If bucket \$b\_i\$ gets more primes than bucket \$b\_j\$ for some value of \$N\$, then \$b\_i\$ continues to get more primes for larger values of \$N\$; however, the ratio of number of primes in \$b\_i\$ to number in \$b\_j\$ reduces with \$N\$ but never quite gets to \$1\$ it seems. Have these phenomena been quantified? Note: Also checked numerically the buckets to which the *second prime* after a prime that hashes to bucket 3 goes. Now, the range of probabilities among the 6 possible buckets is much reduced but for even fairly large N, they don't quite equalize. 1. Is there *some* hash function for primes that has the property: if any prime hashes to a particular bucket, the next higher prime is equally likely to hash to any of the buckets? - [nt.number-theory](https://mathoverflow.net/questions/tagged/nt.number-theory "show questions tagged 'nt.number-theory'") [Share](https://mathoverflow.net/q/467399 "Short permalink to this question") Cite [Improve this question](https://mathoverflow.net/posts/467399/edit) Follow [edited Mar 28, 2024 at 14:33](https://mathoverflow.net/posts/467399/revisions "show all edits to this post") asked Mar 20, 2024 at 17:44 [![Nandakumar R's user avatar](https://lh4.googleusercontent.com/-bPo0_MvZMOY/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3reD_5HN3Fiv-wJPz85HdQSUtD-Xqw/s64-rj/photo.jpg)](https://mathoverflow.net/users/142600/nandakumar-r) [Nandakumar R](https://mathoverflow.net/users/142600/nandakumar-r) 7,49533 gold badges99 silver badges2323 bronze badges \$\\endgroup\$ 8 - 7 \$\\begingroup\$ Granville and Martin wrote a paper where this is discussed: [arxiv.org/pdf/math/0408319.pdf](https://arxiv.org/pdf/math/0408319.pdf) They explain many details of the behaviour of these 'prime races'. Some buckets are fuller than others most of the time, as you have observed. They can quantify by how much some buckets lead, and how often. The tie all this to the Riemann hypothesis - it's a really nice paper. \$\\endgroup\$ Padraig Ó Catháin – [Padraig Ó Catháin](https://mathoverflow.net/users/27513/padraig-%C3%93-cath%C3%A1in "1,380 reputation") 2024-03-20 18:50:22 +00:00 Commented Mar 20, 2024 at 18:50 - 4 \$\\begingroup\$ Writing \$b\$-1 instead of \$b-1\$ is definitely incorrect usage in MathJax or LaTeX. That has been edited above. \$\\endgroup\$ Michael Hardy – [Michael Hardy](https://mathoverflow.net/users/6316/michael-hardy "1 reputation") 2024-03-20 19:21:27 +00:00 Commented Mar 20, 2024 at 19:21 - 2 \$\\begingroup\$ As for the question of dependence of a prime on the previous prime, see Robert J Lemke Oliver and Kannan Soundararajan, Unexpected biases in the distribution of consecutive primes, Proc Nat Acad Sci 113 \#31 (2016) E4446-E4454, available at [pnas.org/doi/full/10.1073/pnas.1605366113](https://www.pnas.org/doi/full/10.1073/pnas.1605366113). Abstract next comment. \$\\endgroup\$ Gerry Myerson – [Gerry Myerson](https://mathoverflow.net/users/3684/gerry-myerson "41,223 reputation") 2024-03-21 06:00:37 +00:00 Commented Mar 21, 2024 at 6:00 - 3 \$\\begingroup\$ Prime numbers ... are well known to be very well distributed among the reduced residue classes \$\\bmod q\$. Surprisingly, the same does not appear to be true for sequences of consecutive primes, with different patterns occurring with wildly different frequencies. We formulate a precise conjecture, based on the Hardy−Littlewood conjectures, which explains this phenomenon. In particular, we predict that all patterns do occur their fair share of the time in the limit, but that there are secondary terms only very slowly tending to zero that create the observed biases. \$\\endgroup\$ Gerry Myerson – [Gerry Myerson](https://mathoverflow.net/users/3684/gerry-myerson "41,223 reputation") 2024-03-21 06:03:01 +00:00 Commented Mar 21, 2024 at 6:03 - 1 \$\\begingroup\$ Doesn't the paper of Oliver and Soundararajan answer question 3, at least conjecturally? "...we predict that all patterns do occur their fair share of the time in the limit...." \$\\endgroup\$ Gerry Myerson – [Gerry Myerson](https://mathoverflow.net/users/3684/gerry-myerson "41,223 reputation") 2024-03-22 00:29:30 +00:00 Commented Mar 22, 2024 at 0:29 \| [Show **3** more comments](https://mathoverflow.net/questions/467399/on-hashing-prime-numbers-into-prime-number-of-buckets "Expand to show all comments on this post") ## 0 Sorted by: [Reset to default](https://mathoverflow.net/questions/467399/on-hashing-prime-numbers-into-prime-number-of-buckets?answertab=scoredesc#tab-top) ## You must [log in](https://mathoverflow.net/users/login?ssrc=question_page&returnurl=https%3A%2F%2Fmathoverflow.net%2Fquestions%2F467399) to answer this question. Start asking to get answers Find the answer to your question by asking. [Ask question](https://mathoverflow.net/questions/ask) Explore related questions - [nt.number-theory](https://mathoverflow.net/questions/tagged/nt.number-theory "show questions tagged 'nt.number-theory'") See similar questions with these tags. #### Linked [45](https://mathoverflow.net/questions/234108/why-such-an-interest-in-studying-prime-gaps "Question score (upvotes - downvotes)") [Why such an interest in studying prime gaps?](https://mathoverflow.net/questions/234108/why-such-an-interest-in-studying-prime-gaps?noredirect=1) [16](https://mathoverflow.net/questions/233633/could-this-unexpected-bias-in-the-distribution-of-consecutive-primes-have-any-im "Question score (upvotes - downvotes)") [Could this unexpected bias in the distribution of consecutive primes have any impact on the security of encryption algorithms?](https://mathoverflow.net/questions/233633/could-this-unexpected-bias-in-the-distribution-of-consecutive-primes-have-any-im?noredirect=1) [6](https://mathoverflow.net/questions/357379/how-to-explain-this-prime-gap-bias-around-last-digits "Question score (upvotes - downvotes)") [How to explain this prime gap bias around last digits?](https://mathoverflow.net/questions/357379/how-to-explain-this-prime-gap-bias-around-last-digits?noredirect=1) [3](https://mathoverflow.net/questions/372572/the-bias-of-consecutive-prime-numbers-towards-being-incongruent-modulo-3 "Question score (upvotes - downvotes)") [The bias of consecutive prime numbers towards being incongruent modulo 3](https://mathoverflow.net/questions/372572/the-bias-of-consecutive-prime-numbers-towards-being-incongruent-modulo-3?noredirect=1) #### Related [34](https://mathoverflow.net/questions/19076/bringing-number-and-graph-theory-together-a-conjecture-on-prime-numbers "Question score (upvotes - downvotes)") [Bringing Number and Graph Theory Together: A Conjecture on Prime Numbers](https://mathoverflow.net/questions/19076/bringing-number-and-graph-theory-together-a-conjecture-on-prime-numbers) [5](https://mathoverflow.net/questions/19261/drawing-graphs-by-numbers-a-minimality-question "Question score (upvotes - downvotes)") [Drawing (graphs) by numbers: a minimality question](https://mathoverflow.net/questions/19261/drawing-graphs-by-numbers-a-minimality-question) [17](https://mathoverflow.net/questions/102075/prime-spiral-distribution-into-quadrants "Question score (upvotes - downvotes)") [Prime spiral distribution into quadrants](https://mathoverflow.net/questions/102075/prime-spiral-distribution-into-quadrants) [5](https://mathoverflow.net/questions/189406/how-to-generate-n-fp32-rationals-s-t-no-two-distinct-k-el-subsets-have-same "Question score (upvotes - downvotes)") [How to generate \$n\$ FP32 rationals s.t. no two distinct k-el. subsets have same sum?](https://mathoverflow.net/questions/189406/how-to-generate-n-fp32-rationals-s-t-no-two-distinct-k-el-subsets-have-same) [Question feed](https://mathoverflow.net/feeds/question/467399 "Feed of this question and its answers") # Subscribe to RSS Question feed To subscribe to this RSS feed, copy and paste this URL into your RSS reader. ![](https://mathoverflow.net/posts/467399/ivc/431b?prg=559ebda2-673d-4435-9e38-bd6a0cc60f6a) ##### [MathOverflow](https://mathoverflow.net/) - [Tour](https://mathoverflow.net/tour) - [Help](https://mathoverflow.net/help) - [Chat](https://chat.stackexchange.com/?tab=site&host=mathoverflow.net) - [Contact](https://mathoverflow.net/contact) - [Feedback](https://meta.mathoverflow.net/) ##### [Company](https://stackoverflow.co/) - [Stack Overflow](https://stackoverflow.com/) - [Stack Internal](https://stackoverflow.co/internal/) - [Stack Data Licensing](https://stackoverflow.co/data-licensing/) - [Stack Ads](https://stackoverflow.co/advertising/) - [About](https://stackoverflow.co/) - [Press](https://stackoverflow.co/company/press/) - [Legal](https://stackoverflow.com/legal) - [Privacy Policy](https://stackoverflow.com/legal/privacy-policy) - [Terms of Service](https://stackoverflow.com/legal/terms-of-service/public) - Cookie Settings - [Cookie Policy](https://policies.stackoverflow.co/stack-overflow/cookie-policy) ##### [Stack Exchange Network](https://stackexchange.com/) - [Technology](https://stackexchange.com/sites#technology) - [Culture & recreation](https://stackexchange.com/sites#culturerecreation) - [Life & arts](https://stackexchange.com/sites#lifearts) - [Science](https://stackexchange.com/sites#science) - [Professional](https://stackexchange.com/sites#professional) - [Business](https://stackexchange.com/sites#business) - [API](https://api.stackexchange.com/) - [Data](https://data.stackexchange.com/) - [Blog](https://stackoverflow.blog/?blb=1) - [Facebook](https://www.facebook.com/officialstackoverflow/) - [Twitter](https://twitter.com/stackoverflow) - [LinkedIn](https://linkedin.com/company/stack-overflow) - [Instagram](https://www.instagram.com/thestackoverflow) Site design / logo © 2026 Stack Exchange Inc; user contributions licensed under [CC BY-SA](https://stackoverflow.com/help/licensing) . rev 2026.4.1.41700
Readable Markdown
Let \$b\$ be any prime. Consider a set of \$b-1\$ buckets. Consider all prime numbers (except \$b\$) up to some \$N\$. Let us do the simple hash wherein each prime \$x\$ less than \$N\$ is assigned to the \$x \\bmod b\$\-th bucket. 1. It is found that as \$N\$ increases, the number of primes getting assigned to the \$b-1\$ buckets get very close to each other very rapidly. Can this rapid reduction in the *range* of numbers of primes hashing to each bucket be quantified as a function of \$N\$ and \$b\$? Note: If \$b\$ is not a prime, then, some of the buckets do not receive any of the primes (for example, if \$b = 8\$, for any prime \$x\$, \$x \\bmod 8\$ can never be \$2\$ and bucket number \$2\$ remains empty) but even then, those buckets with non-zero numbers of primes tend to have very nearly equal numbers of primes (from the comment below from Pedraig O'Cathain, I understand, the numbers of primes in each bucket getting close follows from the 'prime number theorem for arithmetic progressions'). 1. Consider the special case \$b =7\$ and a specific value of the remainder, say \$3\$. Only for those primes that gave hash value (remainder) \$3\$, we looked at the buckets into which the next higher prime would go. It was found that for primes immediately greater than those that hash to \$3\$, their distribution among the buckets is always uneven (i.e., if a prime hashes to \$3\$, the next prime is not equally likely to hash to each possible value \$1\$ to \$6\$) and never seems to equalize among the buckets even if we go to very large \$N\$. If bucket \$b\_i\$ gets more primes than bucket \$b\_j\$ for some value of \$N\$, then \$b\_i\$ continues to get more primes for larger values of \$N\$; however, the ratio of number of primes in \$b\_i\$ to number in \$b\_j\$ reduces with \$N\$ but never quite gets to \$1\$ it seems. Have these phenomena been quantified? Note: Also checked numerically the buckets to which the *second prime* after a prime that hashes to bucket 3 goes. Now, the range of probabilities among the 6 possible buckets is much reduced but for even fairly large N, they don't quite equalize. 1. Is there *some* hash function for primes that has the property: if any prime hashes to a particular bucket, the next higher prime is equally likely to hash to any of the buckets?
Shard199 (laksa)
Root Hash902209275406285599
Unparsed URLnet,mathoverflow!/questions/467399/on-hashing-prime-numbers-into-prime-number-of-buckets s443