Skip to content

Instantly share code, notes, and snippets.

@mschauer
Last active October 14, 2021 16:11
Show Gist options
  • Save mschauer/49029f0e2679d63e00a26747a2c0c4a2 to your computer and use it in GitHub Desktop.
Save mschauer/49029f0e2679d63e00a26747a2c0c4a2 to your computer and use it in GitHub Desktop.
Clement's conjecture
using Distributions
# Search counter examples in exact arithmetic
xpdf(d::Binomial,k) = binomial(d.n, k)*d.p^k*(1 - d.p)^(d.n - k)
f(x,y) = x*y + (1-x)*(1-y)
while true
p = big(rand(1:250)//rand(500:1000))
q = big(rand(1:250)//rand(500:1000))
p, q = minmax(p, q)
m, n = rand(2:10), rand(2:10)
r = big(rand(1:250)//rand(500:1000))
a = sum((f(i//m, j//n)>r)*xpdf(Binomial(m, p), i)*xpdf(Binomial(n, p), j) for i in 0:m, j in 0:n)
b = sum((f(i//m, j//n)>r)*xpdf(Binomial(m, q), i)*xpdf(Binomial(n, q), j) for i in 0:m, j in 0:n)
if a < b
@show n, m, r, p, q
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment