There's nothing wrong with your formula. But since it has a division operation, if you don't set the value of "r" (rank), it may have a default value of 0 (which would be odd but not impossible), and thus your formula would have "n/0" which results in a "division by zero error", since you can't divide something by zero.