# Sum of a particular arithmetic sequence

Let the number $A$ have an unknown, positive value. The numbers $B$ and $C$ have defined values which are known. If we keep subtracting $B$ from $A$ as long as the difference is positive we get some smallest positive value. Let $C$ be the sum of all such positive differences.

As an example, let $$A = 7.2,\quad B = 0.5.$$ The largest multiple of $B$ we can subtract from $A$ and remain positive is $14B$. Hence, $$C = \sum_{k = 1}^{14} (A - kB) = 48.3.$$

Given $B$ and $C$, how can I express $A$ with a formula? Can't figure it out.

• Welcome to MSE. Please use MathJax. – José Carlos Santos May 5 '18 at 10:38
• Thanks for your edit – Adelka Smrčková May 5 '18 at 10:41
• Your wording is confusing. I can subtract B from A for as long as I want and A will still be positive. And $(x - 0.5) + (x - 1) + (x - 1.5) + (x - 2)...$ implies that the series never stops. – steven gregory May 5 '18 at 10:59
• Presumably from your example, what you are actually saying is that you subtract all positive multiples of $B$ from $A$ and then add up all the positive results of these subtractions to give $C$. – Henry May 5 '18 at 22:41

## 1 Answer

I have a partial answer.

As mentioned in the comments, your wording is a little confusing. First you say that $C$ is the smallest positive number you can get by subtracting multiples of $B$ from $A$, but then you say that $C$ is the sum of all such positive differences. I will answer the latter, since it agrees with your example.

I will also assume that $B$ is positive.

We can subtract integer multiples of $B$ from $A$ until $A - kB$ is negative. The "last" one before that happens is $A - mB$, where $$A - (m + 1)B \leq 0 < A - mB.$$ These inequalities are equivalent to $$A - B \leq mB < A,$$ or $$\frac{A}{B} - 1 \leq m < \frac{A}{B}.$$ These inequalities are equivalent to $$m = \left\lceil \frac{A}{B} - 1 \right\rceil = \left \lceil \frac{A}{B} \right \rceil - 1,$$ where $\lceil x \rceil$ is the ceiling of $x$, the smallest integer greater than or equal to $x$.

Therefore, from your definition, $$C = \sum_{k = 1}^m (A - kB),$$ where $m = \lceil A / B \rceil - 1$. This sum evaluates nicely: $$C = mA - B \frac{m (m + 1)}{2}.$$ Assuming that $C > 0$, we will have $$A = \frac{C}{m} + B \frac{m + 1}{2} = \frac{C}{\lceil A / B \rceil - 1} + B \frac{\lceil A / B \rceil}{2}.$$

I am not immediately sure how to solve this equation for $A$, or even if it can be explicitly.