Created
March 10, 2015 13:43
-
-
Save pontikos/4f74862315dee25dac49 to your computer and use it in GitHub Desktop.
Bars and stars algorithm with three bins. Goal is to extend to N bins. If anyone has any ideas?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bars and stars algorithm | |
N=5 | |
for n in range(0,N): | |
x=[1]*n | |
for i in range(0,(len(x)+1)): | |
for j in range(i,(len(x)+1)): | |
print 100-n, sum(x[0:i]), sum(x[i:j]), sum(x[j:len(x)]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment