Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-3= -1-2 for 1,2 don't count
- #+1 = none at all scenario
- import math
- n=50
- sum1=((n*(n-2))/8)+1
- print sum1
- sum = 0
- for i in range(3, int(n/2)):
- print "i:",i
- for k in range(2, int(n/i)+1):#one block of three, two blocks, etc
- print "k:",k
- slots = k+1
- stones = n-(i*k)-(k-1)
- if(slots-stones >= 0 and stones>=0):
- sum += math.factorial(slots)/(math.factorial(slots-stones)*math.factorial(stones))
- elif(slots==stones):
- sum+=1
- print sum+sum1
Advertisement
Add Comment
Please, Sign In to add comment