How to notate a While loop? I've noticed that Sigma notation is a lot like a For loop in programming. What, if anything, can be used to notate a While loop mathematically? 
In other words, how to you notate the sum of everything (like Sigma) while a variable is equal or unequal to a certain number or expression?
 A: It is not uncommon to have notation like $$\sum_{i\in S} f(i)$$
where $S$ is some set of indices for $i$.  Also common is $$\sum_{i\ge 100,\  i\notin S} g(i)$$
where two conditions are combined, and only indices satisfying both are used.
A: A while loop cant be directly written in mathematical notation, however every while loop can be written as a recursive function.
If we have the while loop below, which changes all the variables each iteration using a function for each variable.
a = initial value for a
b = initial value for b
...
while (expression) {
  a = na(a,b,...)
  b = nb(a,b,...)
  ...
}

This can be written as a recursive function as below:
function(a,b,...) {
  if (expression) {
    return a
  } else {
    a_new = na(a,b,...)
    b_new = nb(a,b,...)
    ...
    return function(a_new,b_new,...)
  }
}

A recursive function can easily be written in mathematical notation
$$
f(a,b,\dots)=
\begin{cases}
a\quad&\text{if expression}\\
f(n_a(a,b,\dots),n_b(a,b,\dots),\dots)&\text{if not expression}
\end{cases}
$$
Very often it is possible to write a recursive formula like this one as a sum or product, in which case it is often better to do so.

Examble based on your other question.
In your other question, you could explain the sum (up to some constant N) as the following while loop:
sum = 0
summand = x
iterations_left = N
while (iterations_left > 0) {
  summand = summand / 2
  sum = sum + summand
  iterations_left = iterations_left - 1
}

This can be written as a recursive function the following way:
sum_to(x, iterations) {
  if (iterations == 1) {
    return x/2
  } else {
    return x/2 + sum_to(x/2, iterations - 1)
  }
}

And can such be written as a recursive function
$$
f(x,i)=
\begin{cases}
x/2\quad&\text{if }i=1\\
x/2+f(x/2,i-1)&\text{if }i\ne1
\end{cases}
$$
