3
$\begingroup$

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?

$\endgroup$
1
$\begingroup$

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)$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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