Finding how many numbers are divisible by a prime number

1.2k Views Asked by At

I'm trying to figure out how I can find out how many numbers are divisible by a certain prime (eg 3) in a certain range, eg 0-10000. I think it has something to do with permutations, but I'm not really sure and kinda stuck.

Could you please point me in the right direction or so?

2

There are 2 best solutions below

1
On

All you have to do is divide and throw away any remainder: $\textrm{floor}(10000/3)$

2
On

For your given range there are $1+\left\lfloor \cfrac{10000}{3} \right\rfloor=1+3333=3334$ numbers divisible by $3$. This count includes the end-points of your range ($0$ and $10000$).

The notation $\lfloor x \rfloor$ (known as ‘the floor function’) denotes the largest integer less than or equal to $x \in \mathbb{R}$. Examples include $\lfloor7\rfloor$ = $7$, $\lfloor2.5\rfloor$ = $2$, $\lfloor\pi\rfloor$= $3$ and $\lfloor−2.5\rfloor$ = $-3$.