Shyan's intervals

For how many nonnegative integers n 25 n\le 25 does there exist a set of 1000 1000 consecutive positive integers containing exactly n n primes?

This problem is shared by Shyan A . from the Hungary-Israel Contest.


The answer is 26.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

First, note that the number of primes < 1000 <1000 is > 25 >25 : one can calculate the first few primes, and note that the 2 6 t h 26^{th} prime is 101 101 , which is clearly < 1000 <1000 , hence establishing our claim.

We now claim that all non-negative integers less than 25 25 satisfy the given condition. Let n n be such an integer. Consider a larger positive integer k k . Let m m be the number of primes between k 1 k-1 and k + 1000 k+1000 (boundaries excluded). Note that if we increase k k by 1 1 , m m will either not change at all, or will increase by 1 1 , or will decrease by 1 1 . This is obviously true, because in the process either we lose a prime or we gain one, or neither of these will happen.

Note that we can easily construct a sequence of 1000 1000 consecutive positive integers, none of which contain a prime. Let p 1 , p 2 , . . . , p x p_1, p_2, ..., p_x be the set of primes from 1 1 to 1001 1001 . Consider the sequence p 1 p 2 . . . p x + 2 p_1p_2...p_x + 2 , p 1 p 2 . . . p x + 3 p_1p_2...p_x + 3 , \cdots , p 1 p 2 . . . p x + 1001 p_1p_2...p_x + 1001 . This sequence obviously satisfies the mentioned property.

Now suppose a a and b b are two positive integers for which m m assumes the values c c and d d respectively. From our previous observation, for all positive integers n n between c c and d d , we can find some y y satisfying the given property. Since there exists a sequence of consecutive positive integers for which m m takes the value 0 0 , all non-negative integers between 1 1 and 25 25 satisfy the given property. In conclusion, our answer is 26 \boxed{26} .

Moderator note:

Nice job!

hmm no need for such complexity. simply put primes are extremely dense at the start (2,3,5,7,11 so 5 out of 11) and more and more distant as you go further down the number line. in mathematical terms pi(x) ~ x/log x. so when you reach for example a million, you can easily find a set of 1000 consecutive numbers containing no prime numbers or only one.. because there is no limitation on where to pick the starting line, you can easily pick a starting point that suits your needs, such that the next 1000 numbers will only contain as many primes as you wish.

Daniel Magen - 7 years, 8 months ago

Log in to reply

That's not a rigorous proof

Matt McNabb - 7 years, 8 months ago

Log in to reply

well yeah kinda, but once you mess around with primes for 2 years you come to learn their nature a bit and it just seems instinctive. but actually you can't really have a "rigorous proof" until you have some order to primes which is currently impossible. simply understanding that the density of primes is going down at an unknown rate of approximately pi(x) ~ x/log x (actually x/(log x -1) is a better approach but still) using prime number theorem, is enough to determine that if you pick all possible starting points you are bound to get some 1000 consecutive numbers which has anywhere between ~ 1000/log 1000 to 0 primes in them.

Daniel Magen - 7 years, 8 months ago

Log in to reply

@Daniel Magen You're saying you can't really have a rigorous proof? I think this solution by Sreejato is very rigorous. What's wrong with it?

Tim Vermeulen - 7 years, 8 months ago

I agree that it is mostly based on intuition, but still I like the idea.

Sreejato Bhattacharya - 7 years, 8 months ago

Can you please explain why π ( x ) x l o g x \pi (x) \approx \frac{x}{log x} ? Seems to be related to calculus or growth of functions (and I am extremely poor in both of them). Anyways, thanks for the alternate approach though. :)

Sreejato Bhattacharya - 7 years, 8 months ago

Log in to reply

for the last couple of years I was trying to solve Goldbach's conjuncture (even though I have no special mathematical skills nor did I ever do something mathematical beyond what was needed in school, and even there I had average ability at most (I'm currently 19)). during those last couple of years I tried reading as much as I could on prime numbers so that I will have a greater chance of understanding them. so I learned a few things in the process :) . even though I'm not mathematically skilled enough to explain it, I learned a bit about Prime number theorem. you can read about it on wikipedia or any kind of resource you may find online, I guarantee it will be more helpful than me in that case. btw if you are interested in prime numbers I think you should read about Riemann zeta function and it's use in Prime number theorem.

Daniel Magen - 7 years, 8 months ago

Log in to reply

@Daniel Magen That's okay. I am not introduced to the prime number theorem, but given the intuition is established, your proof becomes a nice one. :)

Sreejato Bhattacharya - 7 years, 8 months ago
Marek Bernat
Sep 17, 2013

Consider the function f : N N f : \mathbb N \to \mathbb N that assigns to n n number of primes between n n and n + 1000 n + 1000 . The problem asks us to understand the range of this function. To that end notice that f ( n ) f ( n 1 ) f(n) - f(n-1) is always either 0 , 1 0, 1 or 1 -1 (because the number of primes in the adjacent intervals can't differ by more than one -- prove this!). Therefore the range of f f forms a set of consecutive integers.

The other part of the proof hangs on the existence of infinite gaps in primes. That is, there exist sets of consecutive integers of arbitrary length that contain no primes. It follows that in these regions our function f f equals 0 0 . Finally, f ( 1 ) > 25 f(1) > 25 (since there are a lot of small primes). Putting these facts together with the observation of consecutive range from the first paragraph, the range of f f includes all the numbers 0 n 25 0 \leq n \leq 25 and the answer is 26 26 .

Moderator note:

Nicely done!

Funny how you ask the reader to prove something. That was your job :P

Tim Vermeulen - 7 years, 8 months ago

Log in to reply

It was very obvious though: in the process we gain at most one prime, or we lose at most one prime. :)

Sreejato Bhattacharya - 7 years, 8 months ago
Pedro Ramirez
Sep 15, 2013

Case 1:

Consider the set of primes

P P = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 }

And let X X be the set of consecutive integers from 1 1 to 1000 1000 inclusive.

As P = 25 | P | = 25 , and P P is a subset of X X , we have found a set of 1000 1000 consecutive integers containing exactly n n primes, for 1 < = n < = 25 1<=n<=25 .

Case 2:

For n = 0 n = 0 , consider the sequence of consecutive numbers

a i = a_i = { 1001 ! + i 1001! + i }, where i i goes from 2 2 to 1001 1001 inclusive.

As 2 < = i < = 1001 2 <= i <= 1001 , i i is a common factor of 1001 ! 1001! and i i , thus the terms of a i a_i are always composite and we have found 1000 1000 consecutive numbers containing 0 0 primes.

From case 1 and case 2 we conclude that there are 26 26 nonnegative integers n < = 25 n <= 25 containing exactly n n primes.

Moderator note:

The original post is incorrect. However Matt M's correction is a valid proof.

I don't follow your argument for Case 1 - the set X X has exactly 168 primes in it so it's not an example of n = 25 n=25 or any lesser value of n n , and P P isn't a set of 1000 consecutive positive integers.

Matt McNabb - 7 years, 8 months ago

Log in to reply

I see, but I can´t find a way to remove the answer. Perhaps I'll have to ask an admin. Thanks.

Pedro Ramirez - 7 years, 8 months ago

Log in to reply

Case 1 can be fixed like this: if you have N . . . N + 1000 N...N+1000 with some number of primes n n , then N + 1... N + 1001 N+1...N+1001 must have n 1 n-1 , n n , or n + 1 n+1 primes, i.e. it can only change by one at a time. Since 1...1000 1...1000 has 168 168 primes, then as we consider every possible set of 1000 consecutive numbers until we get to Case 2, we must cover every possibility between 168 168 and 0 0 .

Matt McNabb - 7 years, 8 months ago

anyone knows which year this problem come from?

Cuong Doan - 7 years, 8 months ago

Log in to reply

We were told it was 2005. There were some edits to the actual question, to get it in the form of a numerical answer.

This is also a very common question to come across.

Calvin Lin Staff - 7 years, 8 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...