Re: [amibroker] Finding all possible combinations of numbers to reach a given sum

 

Hi Howard, thanks for showing interest. I was looking at addtocomposite function, i noticed that the flags have a numerical value (integers). The values are 1,2,4,8,16,32,64,128. If you use number 3 as a flag it will use flags 1 & 2. Now I can write if, then statements or case/switch for every combination. The number of combinations is factorial so as the number of flags increase then writing statements become tedious and impractical. So googled for a solution and I found the Python solution on stackoverflow.com. I thought maybe if logic can be written in afl. I spent the long weekend on it with no success.

The flag numbers are integers, they start with 1 and subsequently would be twice the previous one I don't know what the upper limit would be (some integer in progression I explained). The only restriction is that each number is used once. The sum is used to determine which flags were used.

Best Regards

__._,_.___

Posted by: l3456@excite.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (6)
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/


.

__,_._,___

Related Posts


EmoticonEmoticon

:)
:(
=(
^_^
:D
=D
=)D
|o|
@@,
;)
:-bd
:-d
:p
:ng
:lv