Dominoes: Difference between revisions
Content added Content deleted
m (specify a type for vector) |
m (xtra) |
||
Line 200: | Line 200: | ||
2025 layouts found. |
2025 layouts found. |
||
</pre> |
|||
===Extra credit task === |
|||
<lang julia>""" From https://en.wikipedia.org/wiki/Domino_tiling#Counting_tilings_of_regions |
|||
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 |
|||
""" |
|||
function dominotilingcount(m, n) |
|||
return BigInt(floor(prod( |
|||
[prod( |
|||
[big"4.0" * cospi(j / (m + 1)) + 4 * cospi((k / (n + 1))) for k in 1:n÷2] |
|||
) for j in 1:m÷2] |
|||
))) |
|||
end |
|||
arrang = dominotilingcount(7, 8) |
|||
perms = factorial(big"28") |
|||
flips = 2^28 |
|||
println("Arrangements ignoring values: $arrang") |
|||
println("Permutations of 28 dominos: ", perms) |
|||
println("Permuted arrangements ignoring flipping dominos: ", arrang * perms) |
|||
println("Possible flip configurations: $flips") |
|||
println("Possible permuted arrangements with flips: ", flips * arrang * perms) |
|||
</lang>{{out}} |
|||
<pre> |
|||
Arrangements ignoring values: 158862606 |
|||
Permutations of 28 dominos: 304888344611713860501504000000 |
|||
Permuted arrangements ignoring flipping dominos: 48435356964042922005589392359424000000 |
|||
Possible flip configurations: 268435456 |
|||
Possible permuted arrangements with flips: 13001767133165637372142823086764897337344000000 |
|||
</pre> |
</pre> |
||