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://en.wikipedia.org/wiki/Domino_tiling#Counting_tilings_of_regions
<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(
[big"4.0" * cospi(j / (m + 1)) + 4 * cospi((k / (n + 1))) for k in 1:(n+1)÷2]
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: 2541801700
Arrangements ignoring values: 1671065533809
Permutations of 28 dominos: 304888344611713860501504000000
Permutations of 28 dominos: 304888344611713860501504000000
Permuted arrangements ignoring flipping dominos: 774965712644240130536285719756800000000
Permuted arrangements ignoring flipping dominos: 509488404340715971133309942207348736000000
Possible flip configurations: 268435456
Possible flip configurations: 268435456
Possible permuted arrangements with flips: 208028274458021565214007381729204817100800000000
Possible permuted arrangements with flips: 136764752145912471077652891125763304499183616000000
</pre>
</pre>