jl66
asked on
algorithm: how to seperate a number into a group of small numbers
1) there are 6 numbers 1,2,4,8,16,32,64. Increase by power 2.
2) given a number N <=64, for example 59, see what numbers in 1) consist of 59.
3) a number can be used only once.
It's better to code in DOS shell.
For example, 59 = 32+16+8+2+1
2) given a number N <=64, for example 59, see what numbers in 1) consist of 59.
3) a number can be used only once.
It's better to code in DOS shell.
For example, 59 = 32+16+8+2+1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This will work only for 32bit signed integer, meaning 2,17 billion.
The algorithm is standard binary coding, because of "power 2" in point 1. Why to obscure that fact? Sounds like homework ...
The algorithm is standard binary coding, because of "power 2" in point 1. Why to obscure that fact? Sounds like homework ...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Not homework but simplied real issue.
ASKER