When a problem is being voted on in the Perplexus queue, the journeymen and scholars post comments and vote on the problem. A "thumbs up" (TU) scores +1 point, a "thumbs down" (TD) scores 1, and a comment with no vote scores 0.
Suppose a problem in the queue has A responses and a score of B. Find a formula that gives the number of possible combinations of TU's, TD's and nonvoting comments the problem has received.
Note: For example a problem with 3 responses and a score of +1 has two possibilities: {one TU and two comments} and {two TU's and one TD}
The number is determined by the possible number of positive and negative responses. The neutral responses just make up whatever slack is necessary.
The lowest number of positive responses is just the score itself, assuming that's positive (if it's negative just transpose positive with negative in the following discussion and vice versa; we'll use an absolute value to cover either possibility).
The least number of the majority opinion positive or negative votes is just the absolute value of the score.
Call p the maximum number of votes agreeing with the majority and n the maximum number disagreeing with the majority. Let s be the absolute value of the score and there be r responses.
p  n = s
p + n = r (later use of [] for the floor function will take care of the case of one neutral comment left over)
Adding:
2p = s + r, or actually
p = [(s + r)/2],
where the [square brackets] indicate the floor, or integer, function.
The number of combinations is just the possible number of majority votes, and that is one more than the difference between the maximum and the minimum, remembering that s is the absolute value of the score:
[(s+r)/2]  s + 1.

Posted by Charlie
on 20070515 16:54:39 