Dominoes: Difference between revisions
Content added Content deleted
m (different source for formula) |
|||
Line 202: | Line 202: | ||
</pre> |
</pre> |
||
===Extra credit task === |
===Extra credit task === |
||
<lang julia>""" From https:// |
<lang julia>""" From https://www.math.cmu.edu/~bwsulliv/domino-tilings.pdf |
||
The number of ways to cover an m X n rectangle with m * n / 2 dominoes, calculated |
The number of ways to cover an m X n rectangle with m * n / 2 dominoes, calculated |
||
independently by Temperley & Fisher (1961) and Kasteleyn (1961), is given by |
independently by Temperley & Fisher (1961) and Kasteleyn (1961), is given by |
||
""" |
""" |
||
function dominotilingcount(m, n) |
function dominotilingcount(m, n) |
||
return BigInt(floor(prod( |
return BigInt(floor(prod([prod( |
||
[abs(big"2.0" * cospi(j / (m + 1)) + 2 * im * cospi(k / (n + 1))) for k in 1:n]) |
|||
[prod( |
|||
for j in 1:m] |
|||
) for j in 1:(m+1)÷2] |
|||
))) |
))) |
||
end |
end |
||
Line 225: | Line 224: | ||
</lang>{{out}} |
</lang>{{out}} |
||
<pre> |
<pre> |
||
Arrangements ignoring values: |
Arrangements ignoring values: 1671065533809 |
||
Permutations of 28 dominos: 304888344611713860501504000000 |
Permutations of 28 dominos: 304888344611713860501504000000 |
||
Permuted arrangements ignoring flipping dominos: |
Permuted arrangements ignoring flipping dominos: 509488404340715971133309942207348736000000 |
||
Possible flip configurations: 268435456 |
Possible flip configurations: 268435456 |
||
Possible permuted arrangements with flips: |
Possible permuted arrangements with flips: 136764752145912471077652891125763304499183616000000 |
||
</pre> |
</pre> |
||