Not too hard to translate. Only differences are:
K [rank] = R
B [buy-in cost] = BC
A [add-ons cost] = AC
R [rebuys cost] = RC
So, you can substitute to get:
BM*SQRT(N/R)
BM=((N*BC)+(NR*RC)+(NA*AC))/N
Of course this won't quite work because you have to use assign to assign a value to a new variable (BM):
assign("BM", ((N*BC)+(NR*RC)+(NA*AC))/N)
BM*SQRT(N/R)
Or shorten it to:
(((N*BC)+(NR*RC)+(NA*AC))/N) * SQRT(N/R)