The number of multiples of \(3\) more than \(100\) but less than \(700\).
floor(700/3)-floor(100/3)
So I can just subtract \(100\) to get this expression: The number of multiples of \(3\) more than \(0\) but less than \(600\). So will \(\lfloor 600/3\rfloor\) work too?
no, i don't think so...
counter example : no. of integers greater than 21 but less than 24
*multiples of 3
actually answer = 0, if you do 24-21 , you get 1
with floor(24/3)-floor(21/3) also you get 1 :P
i think you should add 'more than or =' instead of just 'more than' for that formula to work.
Okay :)
Oh, I got why it does that =)
I can just subtract \(1\) if the base case is a multiple of \(3\) right?
(if I am using "more than").
but for your original Q , you don't need to subtract 1 floor(700/3)-floor(100/3) is correct....
Yes because the base case is not a multiple of \(3\). =)
oh, you mean if numbers are multiples of 3.... yes, then subtract 1
Yeah, the numbers that we start and end with. If only one is a multiple of \(3\), subtract \(1\). If both, \(2\). Gotcha!
if both subtract 2 ??? see my counter example both---->but subtract 1 only.
If only one/none is a multiple of 3, subtract 0. If both, 1.
Oh yes
Join our real-time social learning platform and learn together with your friends!