Increment command

Here is a small example:

{factorial=(n)->reduce(seq(1,n), 1, (a, v)->a*v) if n > 0 else 1}
{combination=(n, r)->factorial(n)/factorial(r)/factorial(n-r)}

{n=4}
{x=3}
{p=0.5}
{plist=map(seq(0,x - 1),(i)->combination(n,i)*p^i*(1-p)^(n-i))}
{=sum(plist)}

You can find information about factorial and combination functions below:

Also consider using formtext command to make calculations interactive to your input.