I may be misunderstanding - a bit mask only tells you if something is divisible by 16 or 256 (or any other power of 2)
I think he's saying in base 16 you can make a trick to check divisibility by e.g. 15 in the same way you can check divisibility by 9 in base 10.
So is 0xE1 (225) divisible by 0xF (15)?
0xE + 0x1 = 0xF, so yes.
> I think he's saying in base 16 you can make a trick to check divisibility by e.g. 15 in the same way you can check divisibility by 9 in base 10.
Yeah - I misunderstood there and thought they meant divisibility by 16 or 256 not in base 16 or 256. Should've had my morning coffee first :D
Re:Testing for Divisibility by 19
by raverbashing on Monday November 23, 2020 @07:28AM
(#25186027)
No bitmask will give you divisibility by 3 in base 16
In this case (division by 3 in mod 16) is the same as base 10: if the sum of digits is divisible by 3 then it is divisible (and the "extra digits" are 'c' and 'f')
Examples:
0x3c (60) -> sum = 0xf (divisible)
0x2d (45) -> sum = 0xf (divisible)
You don't need any tricks in that case since a simple bit mask (bit-wise AND) will do the trick then.