Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For school I have to solve some problems involving floor-functions, and I have no clue how to solve this one: for a given $n$, calculate the number of $k$'s, $k\lt n$ such that the number of multiples of 7 between and including $n$ and $n-k$ is bigger then the number of multiples of 7 lower than or equal to k.

I've managed to make it into a formula: $n$ and $k$ are right iff $$ \left \lfloor \frac{n}{7} \right \rfloor-\left\lfloor \frac{n-k}{7}\right \rfloor >\left \lfloor \frac{k}{7} \right \rfloor$$

For $n=17$, these $k$ work (I think): $4,5,6,11,12,13$

Could anyone give me a hint (not the full solution) on how to calculate the number of solutions for a certain n?

share|cite|improve this question
up vote 1 down vote accepted

Hint: If $0 \leqslant k \leqslant n-7$, then

$$\left\lfloor \frac{n-(k+7)}{7}\right\rfloor + \left\lfloor \frac{k+7}{7}\right\rfloor = \left\lfloor \frac{n-k}{7}-1\right\rfloor + \left\lfloor \frac{k}{7}+1\right\rfloor = \left\lfloor \frac{n-k}{7}\right\rfloor + \left\lfloor \frac{k}{7}\right\rfloor.$$

Also, $\left\lfloor \frac{k}{7}\right\rfloor = 0$ for $0 \leqslant k < 7$.

For $0 \leqslant k < 7$, we have $\left\lfloor \frac{k}{7}\right\rfloor = 0$, and $\left\lfloor \frac{n}{7}\right\rfloor > \left\lfloor \frac{n-k}{7}\right\rfloor$ if and only if $k > r$, where $r$ is the least non-negative remainder of $n$ modulo $7$. So $\left\lfloor \frac{n}{7}\right\rfloor - \left\lfloor \frac{n-k}{7}\right\rfloor > \left\lfloor \frac{k}{7}\right\rfloor$ if and only if $k = q\cdot 7 + s$, with $r < s < 7$ and $0 \leqslant q < \left\lfloor \frac{n}{7}\right\rfloor$. The number of $k$s is therefore $\left\lfloor\frac{n}{7}\right\rfloor \cdot (6-r)$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.