We are given 3 numbers, a starting number **A**, an ending number **B** and an integer **K**, find the number of multiples of **K** there is between **A** and **B** inclusive.

a = 6 b = 9 k = 2 Should return 2

The ranges are irrelevant because this is a maths problem and thus regardless of whatever we enter we will always solve this in constant time. The formula we use is the one to calculate the **n-th** term for the sequence of multiples of **k **starting at the first multiple greater than or equal to **a**. This looks like:

an = a1 + (n - 1)k.(I can explain this equation if anyone is interested.)

Where

`an`

is the nth multiple`a1`

is the starting multiple`n`

is the number of multiples

We can solve for n to get `n = ( (an - a1) / k) + 1)`

We can then calculate our other variables as

```
an = Math.floor(b / k) * k
a1 = Math.ceil(a / k) * k
```

Code language: JavaScript (javascript)

And put everything together to get

```
function solution(a, b, k) {
const a1 = Math.ceil(a / k) * k
const an = Math.floor(b / k) * k
return ((an - a1) / k) + 1
}
```

Code language: JavaScript (javascript)

And that’s it.

Today we disemvowel a string. That word is beautiful and means to remove every vowel out of a string. Disemvowel it!

Today I take a break from reading and tackle the simple problem of counting bits in Rust. This is my first Rust solution.

Today I’m looking at functions and loops. They are an important part of any language and deserve a closer look.

Today I take a look at Rust variables and data types. It’s a gentle introduction to a language not too alien from JavaScript.

Today I take a look at cargo, Rust’s answer to npm and yarn. It’s a tool that makes a developer’s life that much easier.