Number of possible marks that can be scored In an examination of $20$ questions, for each question a student can get $-1,0,4$ marks .
Let S be set of all the marks that can received by student.
what is number of elements in S.
I defined a function of marks. Also I let no of questions of $-1$ be $a$, $0$ be $b$, $4$ be $c$.
$M= 4c-a$, $a+b+c= 20$. now at each b 
$M(b=i) = 5c -20-i$, where $i$ takes integer between {0,1,...20}.
I am getting 121 answer. but answer given is $96$
 A: Possible total marks range from $−20$ to $+80$ which suggests $101$ possibilities. 
But $\{+79,+78,+77,+74,+73,+69\}$ are not possible, leaving $95$  possibilities
As I said in the linked question, as a more general expression, suppose that there are $n$ questions with marks $a \lt b \lt c$ and that $c-b$ and $b-a$ are coprime (in which case $c-a$ is too) and that $n \gt 2(c-a)$.  Then I think the number of different totals is $$(c-a)\left(n-\frac{c-a-3}{2}\right)$$ which in this example with $n=20, a=-1,b=0, c=+4$, gives $5 \times (20-1) = 95$, as before.  Curiously, $b$ does not appear in my expression, but is necessary for the coprime requirement  
This stems from a different result saying that given two coprime positive integers $x$ and $y$ it is possible generate almost all positive integers with $ux+vy$ where $u$ and $v$ are non-negative integers, certainly all those greater than $(x-1)(y-1)$ plus half of those from $1$ through to $(x-1)(y-1)$, and then applying this at both the top and the bottom of the list  
