# Show that there exist infinitely many indices $k$ such that the intervals $[k^2,(k+1)^2]$ contain at least one prime number

I have found this exercise:

Show that there exist infinitely many indices $$k$$ such that the intervals $$[k^2,(k+1)^2]$$ contain at least one prime number.

Hint: Use the fact that the set of primes is infinite and the ends of each interval are not prime numbers. This is not the Legendre's Conjecture!

• What goes wrong when you try to follow the hint? – lulu Aug 24 '19 at 10:52
• The hint already obviously answers the question. – Peter Aug 24 '19 at 10:52
• @Peter: How this is possible. – Safwane Aug 24 '19 at 10:53
• Well, every prime falls in such an interval (is between two consecutive squares), and since infinite many primes exist, there cannot be a largest $k$ with this property. Simply because larger and larger primes fall into larger and larger such intervals. – Peter Aug 24 '19 at 10:54
• Your intervals, excluding $(k+1)^2$, form a partition of $\mathbb{R}^{+}$. Obviously, primes will have to "fit" somewhere in that partition. What happens, if by contradiction, you suppose that the number of indexes $k$ is finite? There will be a $K=\max\{k\}<\infty$, right? And primes are not bounded, right? – rtybase Aug 24 '19 at 11:10

Suppose, towards a contradiction, that there are finitely many $$k_i$$ for which the intervals $$[k_i^2, (k_i+1)^2]$$ contain at least one prime number. Let $$n$$ be the number of such indices and we observe that every prime number belongs in the set $$\bigcup_{i=1}^n [k_i^2, (k_i+1)^2].$$ Note that each interval contains finitely many integers, and there are a finite number of such intervals. So there are a finite number of primes. This is absurd of course.
Define $$I_k=[k^2,(k+1)^2]$$. Therefore $$\bigcup_{k=1}^{\infty} I_k=\Bbb N$$Now, what happens if only finitely many $$I_k$$s contain at least a prime? In other words, can infinitely many primes distributed over $$\Bbb N$$ be distributed over a finite number of $$I_k$$s?