Module:Sandbox/TheTruthCreator/Bankruptcy: Difference between revisions
imported>TheTruthCreator No edit summary |
(No difference)
|
Latest revision as of 00:31, 13 July 2016
Documentation for this module may be created at Module:Sandbox/TheTruthCreator/Bankruptcy/doc
local p = {}
function p.pow(b,e)
local n = 1
for i = 1, e, 1 do
n = n * b
end
return n
end
function p.bankruptcy(frame)
local chance = frame.args[1]
local iter = frame.args[2]
local n = 0
if iter == nil then
iter = 10
end
for i = 1, iter, 1 do
n = n + ((p.pow(1 - chance, i - 1) * chance) * (2 * i))
end
return n
end
return p