>>>>>I need to create algorithm (based on an integer number) that by applying some formula or equation to this number I can identify if the number belongs to group 1, 2, or 3 or any combination of them (e.g. 1 and 2, 1 and 3, 1 and 2 and 3, 2 and 3)
>>>>>For example, number 8 would indicate belonging to all three groups (since I can divide this number by the group number without a remainder.
>>>>>Any suggestions?
>>>>
>>>>It just occured to me that the answer is very simple.
>>>
>>>
>>>Is this about your options ? (from yesterday)
>>>
>>>Then the groups are just bits. Test witth BitTest()
>>>
>>>And belonging to all three groups = 7
>>
>>Yes, this is a follow up to the options thread from yesterday. But I can't seem to grasp how to apply BitTest() to this issue. I can't understand how the value of 7 by using BitTest() indicates that 7 belongs to all three groups? Could you please explain?
>
>It may help to visualize the binary numbers. These are the binary combinations of three bits, and their decimal equivalents:
>
>000 = 0
>001 = 1
>010 = 2
>011 = 3
>100 = 4
>101 = 5
>110 = 6
>111 = 7
>
>bittest() checks whether a certain bit (in the binary equivalent) is 1. For example, if you check for the first bit - I am too lazy to check the corresponding parameter now - it will result in true for numbers 4-7.
This is an excellent illustration. Thank you very much!
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham