About the location of natural numbers My question is concerned on the location of natural numbers: 
Find sufficient and necessary conditions on two real numbers $a$ and $b$ such that the open interval $(a,b)$ contain at least one natural number $q$.
 A: I believe that it is sufficient to show that $|a-b|>1$, then there must be some integer $q \in (a,b)$.
I guess we could say that a necessary condition would be that the floors of the decimal representation of $a$ and $b$ must be different (i.e. $|\lfloor a\rfloor-\lfloor b\rfloor|\neq0$), but that seems rather unsatisfying.
A: Think of some examples of intervals $(a,b)$ that don't contain any integers. What do the lengths of those intervals have in common? Play around with interval lengths to get a sufficient condition.
As for necessary conditions, what do we have to know about $a$ and $b$ in order for $(a,b)$ to have any elements? I'm not sure that there are any other necessary conditions than that, though.
First Edit: As one can see from Hagen's answer (and from an easy adaptation of Christian's answer, using the necessary condition that I hinted at), there are, in fact, conditions we can provide that are both necessary and sufficient. I will leave my answer here, as it is useful, I think, but please do not upvote it further, or accept it.
Second Edit: For some reason, Christian decided to delete his answer, rather than fix it, so I will provide a repaired version of it here.
Given $a,b\in\Bbb R,$ the real interval $(a,b)$ contains an integer if and only if $a<b$ (this is the necessary condition I was hinting at above) and at least one of the following conditions holds:

*

*$|b-a|>1$ (this is the sufficient condition I was hinting at above), or

*$\sin(\pi a)\sin(\pi b)<0$ (this comes from Christian's now-deleted answer).

Third (and Final?) Edit: Let me outline a proof of the claim I made in my second edit.
We'll need to assume (or be able to prove) the following basic facts about the sine function:

*

*$x\mapsto\sin(x)$ is a periodic function with fundamental period $2\pi$

*$\sin(0)=0$

*$\sin(x)>0$ whenever $0<x<\pi$

*$\sin(x)<0$ whenever $-\pi<x<0$
Using these four facts, we can prove

Lemma 1: $\sin(x)=0$ if and only if $x=n\pi$ for some integer $n.$ $\Box$
Lemma 2: $\sin(x)>0$ if and only if $n\pi<x<(n+1)\pi$ for some even integer $n.$ $\Box$
Lemma 3: $\sin(x)<0$ if and only if $n\pi<x<(n+1)\pi$ for some odd integer $n.$ $\Box$

From these Lemmas, it immediately follows that

Corollary 1: $\sin(\pi x)=0$ if and only if $x$ is an integer. $\Box$
Corollary 2: $\sin(\pi x)>0$ if and only if $n<x<n+1$ for some even integer $n.$ $\Box$
Corollary 3: $\sin(\pi x)<0$ if and only if $n<x<n+1$ for some odd integer $n.$ $\Box$

Putting Corollaries $1$ through $3$ together, we can show that

Proposition 1: Given $a,b\in\Bbb R$ with $a<b,$ the following are equivalent:

*

*$\sin(\pi a)\sin(\pi b)<0$

*$a\notin\Bbb Z,$ $b\notin\Bbb Z,$ and $\bigl|(a,b)\cap\Bbb Z\bigr|=2k+1$ for some nonnegative integer $k.$ $\Box$
Proposition 2: Given $a,b\in\Bbb R$ with $a<b,$ the following are equivalent:

*

*$\sin(\pi a)\sin(\pi b)=0$

*$a\in\Bbb Z$ or $b\in\Bbb Z.$ $\Box$
Proposition 3: Given $a,b\in\Bbb R$ with $a<b,$ the following are equivalent:

*

*$\sin(\pi a)\sin(\pi b)>0$

*$a\notin\Bbb Z,$ $b\notin\Bbb Z,$ and $\bigl|(a,b)\cap\Bbb Z\bigr|=2k$ for some nonnegative integer $k.$ $\Box$

Now, to bring (most of) it home!

Theorem 1: Suppose that $a,b\in\Bbb R.$ Then there is an integer in $(a,b)$ if and only if both of the following hold:

*

*$a<b$ and


*$|b-a|>1$ or $\sin(\pi a)\sin(\pi b)<0.$

Proof: First, let's suppose that there is an integer in $(a,b),$ meaning that $(a,b)\cap\Bbb Z\neq\emptyset.$ Consequently, $(a,b)\neq\emptyset,$ and so $a<b,$ as desired. Suppose that $m,n\in(a,b)\cap\Bbb Z,$ with $m\le n.$ Since $a<m,$ then $-m+a<0,$ so $-m<-a,$ and consequently, $$b-m<b-a.\tag{1}$$ Furthermore, $n<b,$ so $$n-m<b-m.\tag{2}$$ By $(1)$ and $(2),$ since $m\le n,$ then $$\lvert n-m\rvert=n-m<b-m<b-a.\tag{3}$$ As $m,n$ are arbitrary elements of $(a,b)\cap\Bbb Z,$ then the distance between elements of $(a,b)\cap\Bbb Z$ is necessarily finite, and so $(a,b)\cap\Bbb Z$ is a finite set, so has either an odd number of elements or an even number of elements. If it has an odd number of elements, then by Proposition 1, we have $\sin(\pi a)\sin(\pi b)<0.$ On the other hand, if it has an even number of elements, then there exist distinct elements $m,n,$ and so by $(3),$ we have $1\le|n-m|<b-a\le|b-a|,$ as desired.
For the other implication, we proceed by way of the contrapositive, and assume that condition 1 fails or condition 2 fails. We show that $(a,b)\cap\Bbb Z=\emptyset.$ If condition 1 fails, then $(a,b)=\emptyset,$ so $(a,b)\cap\Bbb Z=\emptyset,$ as desired. Suppose instead that condition 2 fails, meaning that $|b-a|\le 1$ and $\sin(\pi a)\sin(\pi b)\ge 0.$ In the case $\sin(\pi a)\sin(\pi b)=0,$ we have by Proposition 2 that at least one of $a,b$ is an integer, and since the other is within $1$ of it, then there can be no integer in the interval, meaning $(a,b)\cap\Bbb Z=\emptyset,$ as desired. On the other hand, let's suppose that $\sin(\pi a)\sin(\pi b)>0,$ so that by Proposition 3, $(a,b)\cap\Bbb Z$ has $2k$ elements for some non-negative integer $k.$ However, by reasoning as we did in $(1)$ through $(3)$ above, we find that the distance between elements of $(a,b)$ must be less than $1,$ while distinct integers are at least $1$ away from each other, so $(a,b)\cap\Bbb Z$ cannot have distinct elements. Hence, $k$ cannot be positive, and so $(a,b)\cap\Bbb Z=\emptyset,$ as desired. $\Box$
However, you weren't asking about integers, but about natural numbers--which for you means positive integers. Consequently, you'd want the following

Corollary 4: Suppose that $a,b\in\Bbb R.$ Then there is a natural number in $(a,b)$ if and only if all of the following hold:

*

*$b>1,$


*$a<b,$ and


*$|b-a|>1$ or $\sin(\pi a)\sin(\pi b)<0.$ $\Box$


Alternatively, expanding on Hagen's answer, we have:
Theorem 2: Suppose that $a,b\in\Bbb R.$ Then there is a natural number in $(a,b)$ if and only if both of the following hold:


*

*$b>1$ and


*$\lceil b\rceil-\lfloor a\rfloor>1.$

Proof: Suppose there is a natural number in $(a,b),$ say $n.$ Since $1\le n<b,$ then 1 holds. Since $\lfloor a\rfloor$ is an integer with $\lfloor a\rfloor\le a<n,$ then $n-\lfloor a\rfloor\ge1.$ Since $\lceil b\rceil$ is an integer with $n<b\le\lceil b\rceil,$ then $\lceil b\rceil-n\ge1,$ so $$\lceil b\rceil-\lfloor a\rfloor=\lceil b\rceil-n+n-\lfloor a\rfloor\ge1+n-\lfloor a\rfloor\ge2>1,$$ so 2 holds.
For the other implication, suppose that $b>1$ and $\lceil b\rceil-\lfloor a\rfloor>1.$ By definition, both $\lceil b\rceil$ and $\lfloor a\rfloor$ are integers, so from $\lceil b\rceil-\lfloor a\rfloor>1$ we have that $$\lceil b\rceil-\lfloor a\rfloor\ge2,$$ $$\lfloor a\rfloor+2\le\lceil b\rceil,$$ and so $$\lfloor a\rfloor-1<\lfloor a\rfloor<\lfloor a\rfloor+1\le\lceil b\rceil-1.\tag{1}$$ Since $\lfloor a\rfloor\le a<\lfloor a\rfloor+1,$ then by $(1),$ we have $$a<\lceil b\rceil-1.\tag{2}$$ Similarly, $\lceil b\rceil-1<b\le\lceil b\rceil,$ so we have by $(2)$ that $a<\lceil b\rceil-1<b,$ and so $$\lceil b\rceil-1\in(a,b)\cap\Bbb Z.\tag{3}$$ Now, given any integer $n,$ we have $n<b$ if and only if $n<\lfloor b\rfloor.$ In particular, since $b>1,$ then $1<\lfloor b\rfloor,$ and since $\lfloor b\rfloor$ is an integer, then $$2\le\lfloor b\rfloor\le b\le\lceil b\rceil,$$ and so $$1\le\lceil b\rceil-1.\tag{4}$$ By $(3)$ and $(4),$ we have $$\lceil b\rceil-1\in(a,b)\cap\Bbb N,$$ as desired. $\Box$
A: $\lceil b\rceil - \lfloor a\rfloor >1$ is necessary and sufficient for (aka. equivalent to) the existence of an integer in $(a,b)$.
A: This is a little exegesis on Hagen von Eitzen's wonderfully simple answer, $\lceil b\rceil-\lfloor a\rfloor\gt1$ as a necessary and sufficient condition for there to be an integer in the open interval with endpoints $a$ and $b$.  
The one drawback to this formula is that it relies on the tacit assumption $a\le b$.  In comments below Hagen's answer I proposed a formula that was agnostic on the issue of which was bigger, but the formula I gave fails rather badly, so I'd just as soon no one look it.
One can, of course, replace $a$ and $b$ with $\min(a,b)$ and $\max(a,b)$ in Hagen's formula.  In fact, playing with the identities $\lceil x\rceil=-\lfloor -x\rfloor$ and $\max(a,b)=-\min(-a,-b)$, one can write the condition as
$$\lfloor\min(a,b)\rfloor+\lfloor\min(-a,-b)\rfloor\lt-1$$
But it'd be nice, I thought, not to use the comparison function(s), and give a necessary and sufficient condition strictly in terms of arithmetic operations and the floor (and ceiling) function.  So here's one which, unlike my first proposal, actually works:
$$\left(\lfloor a\rfloor-\lfloor b\rfloor \right)\left(\lceil a\rceil-\lceil b\rceil \right)\left(\left(a-\lfloor a\rfloor \right)^2+\left(b-\lfloor b\rfloor \right)^2+\left((a-b)^2-1 \right)^2 \right)\not=0$$
That is, the only way there is no integer between $a$ and $b$ is if $a,b\in[k,k+1]$ for some integer $k$, in which case either $a$ and $b$ both round down to $k$, or both round up to $k+1$, or else one is $k$ and the other is $k+1$, which is to say, they are both integers and they differ by $1$.  The three factors on the left hand side correspond to these three possibilities.
The obvious drawback here is the formula's ungainliness.  But I'm hard pressed to think of anything substantially simpler.  I'd be happy to see a gainlier one.
