|
||||||||||||
|
||||||||||||
| ||||||||||||
Yes you can. The easiest thing is to divide by the number, ignoring the "remainder". Then see if the dividend is odd. If it is odd, the number is included. For example, is "8" included by 28703? 28703 / 8 = 3587 remainder 7. Since 3587 is odd, then 8 is indeed included by 28703. Cheers, Hi Abraham. I just re-read your question. If you are programming on a computer, the "logical and" function is very useful for this kind of thing. It compares binary bits and tells you which bits are set in both of two variables. For example, in the language C, the expression (28703 & 8) has the value 8, because 8 is included. On the other hand, (28711 & 8) has the value 0, because 8 is not included. All modern programming languages support bitwise "logical and" operations. You will need to find the syntax used for your environment. Stephen La Rocque. | ||||||||||||
|
||||||||||||
Math Central is supported by the University of Regina and The Pacific Institute for the Mathematical Sciences. |