Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2007-01-09 20:08:04

Toast
Real Member
Registered: 2006-10-08
Posts: 1,321

Numbers which are divisible

Question
How many numbers between 100 and 500 (inclusive) are divisible by either 4 or 5?

The correct answer is 161 numbers. I am out by just one, with an answer of 160. Can someone please correct my working so it gives the correct answer. Thanks.

Solution:
Let n(A) = numbers divisible by 4
Since (500÷4)-(99÷4) = 100.25, there are 100 numbers between 100 and 500 divisible by 4.
i.e. n(A) = 100.

Let n(B) = numbers divisible by 5
Since (500÷5)-(99÷4) = 80.2, there are 80 numbers between 100 and 500 divisible by 5.
i.e. n(B) = 80.

To find n(A and B), notice that if a number is divisible by both 4 and 5, it must also be divisible by 20.
Since (500÷20)-(99÷4) = 20.05, there are 20 numbers between 100 and 500 divisible by 20.

Using n(A or B) = n(A) + n(B) - n(A and B) gives
         n(A or B) = 100 + 80 - 20
∴      n(A or B) = 160
Hence, there are 160 numbers between 100 and 500 divisible by either 4 or 5.

Offline

#2 2007-01-09 20:55:54

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,711

Re: Numbers which are divisible

Not a full analysis of your approach, just your first part:

How many numbers are divisible by 4 between 16 and 20?

Since (20÷4)-(15÷4) = 1.25, hence 1 or 2?


"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

#3 2007-01-09 21:26:40

Toast
Real Member
Registered: 2006-10-08
Posts: 1,321

Re: Numbers which are divisible

Oh noes it doesn't make any sense! dunno

Offline

#4 2007-01-09 23:13:07

mathsyperson
Moderator
Registered: 2005-06-22
Posts: 4,900

Re: Numbers which are divisible

It makes perfect sense. Because of MathsIsFun's discovery, you need to add 1 to each of the numbers that you worked out.

So now your answer is 101+81-21 = 161.


Why did the vector cross the road?
It wanted to be normal.

Offline

#5 2007-01-10 12:43:30

Toast
Real Member
Registered: 2006-10-08
Posts: 1,321

Re: Numbers which are divisible

Oh i see, so if I'm looking for integers between x and y, where x > 0, then I simply have to add one.

But what if I had a question, to say, find between 14 and 18 (inclusive) all integers divisible by 4:
(18 ÷ 4) - (13 ÷ 4) = 1.25. If I were to round this up as has been suggested it would be incorrect.

Offline

#6 2007-01-10 16:18:11

Toast
Real Member
Registered: 2006-10-08
Posts: 1,321

Re: Numbers which are divisible

Oh I see, 99 ÷ 4 = 24.75. Rounded down = 24. If I had seperately worked that out instead of using the combined sum that I used, I would have gotten 101 for my answer.

Thanks everyone.

Offline

#7 2007-01-10 16:20:50

pi man
Member
Registered: 2006-07-06
Posts: 251

Re: Numbers which are divisible

You would always round down.   And it really makes mores sense if you round down the intermediate steps.   Consider the 14 through 18 (inclusive) example.   You divide 18 by 4 to find out how many multiples of 4 there are.   You get 4 1/2 but you can't really have 1/2 of a multiple of 4.   You really should round down to 4 here. 

And dividing 13 by 4 gives you 3 1/3.   Round it down to 3 and subtract it from 4 to get 1.

Edited: Looks like I'm a minute late on my reply!

Last edited by pi man (2007-01-10 16:22:15)

Offline

#8 2007-01-10 16:23:51

Toast
Real Member
Registered: 2006-10-08
Posts: 1,321

Re: Numbers which are divisible

Thanks anyway pi man, I guess I got too used to doing it in one step, as I have learned to do with surds and trig to 'keep things accurate' smile

Offline

#9 2007-01-10 20:21:34

Toast
Real Member
Registered: 2006-10-08
Posts: 1,321

Re: Numbers which are divisible

This is, in a way related,

Does 'int' in int(x) stand for integer? If it does then is x rounded up or down?

Offline

#10 2007-01-10 20:52:40

mathsyperson
Moderator
Registered: 2005-06-22
Posts: 4,900

Re: Numbers which are divisible

Google says that the int stands for integral, and that int (f,x) is equivalent to saying ∫f dx.


Why did the vector cross the road?
It wanted to be normal.

Offline

#11 2007-01-10 20:54:15

Toast
Real Member
Registered: 2006-10-08
Posts: 1,321

Re: Numbers which are divisible

Oh...in my book it says

int(1000 ÷ 7) = 142

Offline

#12 2007-01-10 22:25:39

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,711

Re: Numbers which are divisible

Depends on the computer language, but usually int(x) returns the integer part, so int(12.2) = 12


"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

#13 2007-01-10 22:44:20

Toast
Real Member
Registered: 2006-10-08
Posts: 1,321

Re: Numbers which are divisible

If the x value's tenth's column is greater than or equal to 5, then is x rounded up, or is it always rounded down?

Offline

#14 2007-01-11 04:02:17

pi man
Member
Registered: 2006-07-06
Posts: 251

Re: Numbers which are divisible

In the computer languages I've dealt with, the INT function always rounds down to the nearest integer.  In other words, it truncates.      If you wanted to round up any number with 5 or greater in the tenth's, you would do something like:  INT (X+.5).   If X was 12.1, X+.5=12.6, and the INT function would still chop it off to 12.   If X was 12.6, X+.5 = 13.1 and the INT function would chop it off to 13, effectively rounding up.

Offline

#15 2007-01-13 05:49:50

Carly_baby_2
Guest

Re: Numbers which are divisible

up Thats Correct! I have had trouble with that one myself!

#16 2007-01-13 07:36:56

pi man
Member
Registered: 2006-07-06
Posts: 251

Re: Numbers which are divisible

And if you wanted you program to round to the nearest hundred, it would look something like this:
x = INT(x/100 + .5) * 100

Test Examples:
If x = 1949
x/100 = 19.49
x/100 + .5 = 19.99
INT (x/100 + .5) = 19
INT(X/100 + .5) * 100 = 1900

If x = 1950
x/100 = 19.5
x/100 + .5 = 20.0
INT(x/100 + .5) = 20
INT(x/100 + .5) * 100 = 2000

If x = 1951
x/100 = 19.51
x/100 + .5 = 20.01
INT(x/100 + .5) = 20
INT(x/100 + .5) * 100 = 2000

Offline

#17 2007-01-13 15:49:32

Toast
Real Member
Registered: 2006-10-08
Posts: 1,321

Re: Numbers which are divisible

Oooh interesting, can't wait to learn computer programming.

Offline

Board footer

Powered by FluxBB