Dominoes: Difference between revisions
Content added Content deleted
m (different source for formula) |
m (correct formula) |
||
Line 202: | Line 202: | ||
</pre> |
</pre> |
||
===Extra credit task === |
===Extra credit task === |
||
<lang julia>""" From https:// |
<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 |
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 |
||
Line 208: | Line 208: | ||
function dominotilingcount(m, n) |
function dominotilingcount(m, n) |
||
return BigInt(floor(prod([prod( |
return BigInt(floor(prod([prod( |
||
[ |
[big"4.0" * (cospi(j / (m + 1)))^2 + 4 * (cospi(k / (n + 1)))^2 |
||
for j in 1:m] |
for k in 1:(n+1)÷2]) for j in 1:(m+1)÷2] |
||
))) |
))) |
||
end |
end |
||
Line 222: | Line 222: | ||
println("Possible flip configurations: $flips") |
println("Possible flip configurations: $flips") |
||
println("Possible permuted arrangements with flips: ", flips * arrang * perms) |
println("Possible permuted arrangements with flips: ", flips * arrang * perms) |
||
</lang>{{out}} |
|||
<pre> |
<pre> |
||
Arrangements ignoring values: |
Arrangements ignoring values: 1292697 |
||
Permutations of 28 dominos: 304888344611713860501504000000 |
Permutations of 28 dominos: 304888344611713860501504000000 |
||
Permuted arrangements ignoring flipping dominos: |
Permuted arrangements ignoring flipping dominos: 394128248414528672328712716288000000 |
||
Possible flip configurations: 268435456 |
Possible flip configurations: 268435456 |
||
Possible permuted arrangements with flips: |
Possible permuted arrangements with flips: 105797996085635281181632579889767907328000000 |
||
</pre> |
</pre> |
||