henh...:
> where N= number of people/rooms the relevant numbers
> (we're concerned about) grows proportional to N^N
N^N is the total number of terms in the expansion of:
(a_1 + ... + a_n)^n
But if you group compatible terms there will remain much
fewer summands, and then if you group terms with identical
power-sets (e.b. a^2 b and a b^2) the total number of unique
summands will futher decrease and become equal to the number
of partitions (OEIS A000041). The performance of my program
is roughly proportional to that number, but in fact a bit
worse because as the sheer numbers increase the calculation
of factorial ratios becomes harder. In the following table,
`n' is the number of rooms and people, `s' the number of
summands, `ms' calculation time in milliseconds, and `res'
the calculated answer:
n s ms s/ms res
1 1 0 0 1.000000
2 2 0 0 1.500000
3 3 0 0 1.888889
4 5 0 0 2.125000
5 7 0 0 2.286400
6 11 0 0 2.408179
7 15 0 0 2.509065
8 22 0 0 2.597233
9 30 0 0 2.676479
10 42 0 0 2.748689
.....................................
30 5604 15 373 3.492990
31 6842 32 213 3.513329
32 8349 31 269 3.532941
33 10143 47 215 3.551881
34 12310 47 261 3.570201
35 14883 62 240 3.587945
36 17977 78 230 3.605155
37 21637 94 230 3.621868
38 26015 125 208 3.638117
39 31185 141 221 3.653932
40 37338 171 218 3.669340
41 44583 204 218 3.684366
42 53174 250 212 3.699032
43 63261 328 192 3.713357
44 75175 375 200 3.727360
45 89134 453 196 3.741058
46 105558 562 187 3.754466
47 124754 641 194 3.767597
48 147273 734 200 3.780465
49 173525 907 191 3.793081
50 204226 1062 192 3.805455
51 239943 1313 182 3.817597
52 281589 1578 178 3.829517
53 329931 1797 183 3.841223
54 386155 2125 181 3.852722
55 451276 2500 180 3.864022
56 526823 2921 180 3.875129
57 614154 3500 175 3.886051
58 715220 4094 174 3.896791
59 831820 4750 175 3.907358
60 966467 5547 174 3.917754
61 1121505 6547 171 3.927986
62 1300156 7719 168 3.938057
63 1505499 9609 156 3.947973
64 1741630 10891 159 3.957737
65 2012558 12500 161 3.967353
66 2323520 15187 152 3.976826
67 2679689 16625 161 3.986158
68 3087735 19235 160 3.995353
69 3554345 22484 158 4.004414
70 4087968 25953 157 4.013345
.....................................
99 169229875 1321266 128 4.226524
100 190569292 1502828 126 4.232595
I wonder what is the sequence and formula for the number
of summands when the number of people is not equal to the
number of rooms...