Quote:
Pehmyt said:
In all expressions X=5n+r, with 1<=r<=5 (note limits!).
|
With a little redesign, this translates into python code as follows:
Code:
# p(2d6oe) >= x (Pehmyt's version)
def doubledrn_3(x):
n = (x-1) / 5
r = (x-1) % 5
r += 1
return float((62-15*r+r*r)*5*n+70+3*r-r*r)/(2*6**(n+2))
which produces the right output. Very nice! I think that if you lose the tricky quotient/remainder representation of yours and just work on x-1 like I did in my third attempt, your formula might look a little simpler than the current one.