DutchAlympiade2011

117 days ago by paulvangorsel

####################################################### #Problem no.3 of the Dutch Alympiade contest 2011. #A December lottery has 63 possible images to divide over 31 days. #There are 3,4,5,6,7,8,9,10 and 11 different images i.e. 11 stars and 4 boxes. #Consider the possibility that two million copies of the Count Down 2012 #scratch cards are different. 
       
n=31 mset=[3,4,5,6,7,8,9,10,11] f = lambda x: x+1 Mset=list(sage.combinat.generator.map(f,mset)) mset,Mset 
       
([3, 4, 5, 6, 7, 8, 9, 10, 11], [4, 5, 6, 7, 8, 9, 10, 11, 12])
([3, 4, 5, 6, 7, 8, 9, 10, 11], [4, 5, 6, 7, 8, 9, 10, 11, 12])
A=[[i for i in range(Mset[j])] for j in range(len(mset))] A 
       
[[0, 1, 2, 3], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5,
6], [0, 1, 2, 3, 4, 5, 6, 7], [0, 1, 2, 3, 4, 5, 6, 7, 8], [0, 1, 2, 3,
4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11]]
[[0, 1, 2, 3], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5, 6], [0, 1, 2, 3, 4, 5, 6, 7], [0, 1, 2, 3, 4, 5, 6, 7, 8], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]]
B=[[A[k][j] for i in range(lcm(Mset)/Mset[k]) for j in range(Mset[k])] for k in range(len(Mset))] 
       
C=[[B[i][j] for i in range(len(B))] for j in range(lcm(Mset))] 
       
#################################################### #show the first 3 arrangements f = lambda x: x if sum(x)==n else None G=list(sage.combinat.generator.select(f,C)) show(G[i] for i in range(3)) 
       
\newcommand{\Bold}[1]{\mathbf{#1}}\left[\left[0, 0, 2, 6, 4, 2, 0, 9, 8\right], \left[2, 2, 4, 1, 6, 4, 2, 0, 10\right], \left[1, 3, 3, 5, 1, 6, 3, 0, 9\right]\right]
\newcommand{\Bold}[1]{\mathbf{#1}}\left[\left[0, 0, 2, 6, 4, 2, 0, 9, 8\right], \left[2, 2, 4, 1, 6, 4, 2, 0, 10\right], \left[1, 3, 3, 5, 1, 6, 3, 0, 9\right]\right]
##################################################### #Really amazing! len(G) 
       
1296
1296
import numpy as np 
       
##################################################### #evaluate every multinomial and show the result #of the first 3 combinations f = lambda x: factorial(x) K=[factorial(n)/np.prod(list(sage.combinat.generator.map(f,G[i])), dtype=object) for i in range(len(G))] show(K[i] for i in range(3)) 
       
\newcommand{\Bold}[1]{\mathbf{#1}}\left[8130822550115265000, 682989094209682260000, 1214202834150546240000\right]
\newcommand{\Bold}[1]{\mathbf{#1}}\left[8130822550115265000, 682989094209682260000, 1214202834150546240000\right]
##################################################### #luckily nothing went wrong len(K) 
       
1296
1296
#################################################### #Big relief, it's enough! np.sum(K,dtype=object) 
       
44201678727275783418044340
44201678727275783418044340