Created
April 2, 2020 16:22
-
-
Save eriktaubeneck/42b426fb05a23d9224673a02c046bebd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function not_inc(x) | |
Float64(x) == Float64(x+1) | |
end | |
function perc_inc(e, n) | |
s = 0 | |
for i in 0:n | |
s += Int(not_inc(2^e + i)) | |
end | |
1-s/n | |
end | |
# julia> perc_inc(53, 2^20) | |
# 0.4999990463256836 | |
# julia> perc_inc(54, 2^20) | |
# 0.2499990463256836 | |
# julia> perc_inc(55, 2^20) | |
# 0.1249990463256836 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment