Find $n$ when given $12.3 + 16.4(n-1) - 4.1\left\lfloor\frac{n-1}{5}\right\rfloor $ Pardon me if this question has been posted incorrectly here. My question is pretty simple.  
I am designing a timer in Arduino and the number of counts required to go for $n$ number of seconds vary as following  
$$\text{count} = 12.3 + 16.4(n-1) - 4.1\left\lfloor\frac{n-1}{5}\right\rfloor  $$
I am given the value of $\text{count}$. From this equation how can I frame an exact equation that can give me the $\text{seconds}$ value, i.e., the exact value of $n$ by resolving the integer-part factor that comes in the last term.
 A: Write $n-1 = 5 k + j$ where $0 \le j < 5$, so $\lfloor \dfrac{n-1}{5} \rfloor = k$.  Then $count = 12.3 + 16.4 (5k + j) - 4.1 k$.  Solve for $k$:
$$ k = \dfrac{10\; count - 123 - 164 j}{779}$$
which must be an integer in the range
$$ \dfrac{10\; count - 123}{779} \ge k > \dfrac{10\; count - 943}{779}$$
Now (if you're not requiring $n$ to be an integer) there may be two integers
in this range, e.g. if $count=246$ we could have $k=3$, $j=0$, $n=16$ or 
$k=2$, $j=4.75$, $n=15.75$.  But if $n$ is required to be an integer, $j \le 4$, and there can be at most one integer $k$ with
$$ \dfrac{10 \; count - 123}{779} \ge k \ge \dfrac{10 \; count}{779} - 1 $$
However, there may be none.
A: I don't mean to be a downer but it doesn't exist. Don't worry though, I put might best effort in and got you a solution.
$$count=A+B \cdot (n-1)-C \cdot int \left({{n-1} \over 5}\right)$$
partially solve...
$${{count-A} \over C}={B \over C} \cdot (n-1)-int\left({{n-1} \over 5}\right)$$
$${{count+B-A} \over C}={B \over C} \cdot n-int\left({{n-1} \over 5}\right)$$
You said you know the value of count, so we'll just transform the variable to $Y(n)$
$$Y={B \over C} \cdot n-int\left({{n-1} \over 5}\right)$$
Now, if you haven't noticed already, every time the $int(arg)$ ticks up, the graph of this function will move down 1 unit in a discontinuous fashion. The slope of this equation is ${B \over C}$. Sadly this slope is positive, so the graph is not invertible, you can't get unique values of n from unique values of Y. The periodicity of the jumps is once every 5 seconds displaced one unit to the right. Using the formula for slope, we find that the Y distance covered in this time frame is equal to 20 units, or 4 units per second. So the recovery time after each jump is a quarter of a second. During this "recovery" time, the previous period and current periods Y values overlap, thus the solution to this problem is not a function. However, for 4.5 out 5 seconds the solution is a function. Invert the slope, and we find the solution should have a slope of 1/4 and will move one unit to the right every 20 units. The displacement is 5 units.
As an equation...
$$x(Y)=Y-int \left({{Y+15} \over {20}} \right)$$
$$n(Y)={1 \over 4} \cdot \left({Y} \right)-{1 \over 4}$$
What does it mean? n(Y) is seconds given in Y, substitute for your count value. x(Y) incase you want to graph. For 4.5 out of 5 values given, you'll get a solution. Its for all intents and purposes 90% solved!
Edit: This was wrong for a couple of minutes
