0
$\begingroup$

I have problem with arithmetic.

For example,

$$\begin{align} \text{My cash} &= 2000 \\ \text{Gold Price} &= 20 / \text{gold} \\ \text{Increment / buying gold} &= 0.01 \end{align}$$

I would like to buy gold using my cash. How to get the actual gold amount that I can buy?

Just for enlightment

For example, I would like to buy 5 gold, so it would be as follows

$$20+20.01+20.02+20.03+20.04$$

Total price to spend would be,

$$\begin{align} u_n &= \text{initial}+(n-1)\cdot\text{diff} \\ &= 20+(5-1)\cdot 0.01 \\ &= 20.04 \\ \\ \text{sum} &= \frac{n}{2}(\text{initial}+u_n) \\ &= \frac52(20+20.04)\\ &= 100.1 \end{align}$$

There is for buying $5$ gold.

If I am going to use all my wallet to buy gold, how many gold can I buy?

$\endgroup$
5
  • $\begingroup$ You are almost there. Instead of numbers use variables. In your last equation replace un with the expression above. You should get a quadratic equation in $n$. Solve it to find n. $\endgroup$
    – Andrei
    May 15, 2022 at 17:27
  • $\begingroup$ Sure, I am going to learn quadratic equation. So, we do not need to state the n, we need to find n value. Anyway, do you have reference regarding this case? $\endgroup$
    – Bobby
    May 15, 2022 at 17:56
  • $\begingroup$ @BobbyJulian Don't google it $-$ take some time to try to solve $x^2 - 5x + 6 = 0$ yourself. It won't be easy, but it will be worth it! Once you get the answer, or if you are seriously stuck, you can learn how to solve a generalised quadratic equation here. $\endgroup$
    – user905694
    May 15, 2022 at 18:09
  • $\begingroup$ Sure, I am watching youtube now. $\endgroup$
    – Bobby
    May 15, 2022 at 18:12
  • $\begingroup$ @BobbyJulian Once you understand arithmetic progressions, I suggest you try to solve $x^2 - 5x + 6 = 0$ yourself. It will be a fun challenge. $\endgroup$
    – user905694
    May 15, 2022 at 18:14

2 Answers 2

0
$\begingroup$

Let's say $c$ is the total cash you pay, $n$ is the number of gold, $p$ is the price per gold and $i$ is the increment. Thus, following the same steps you took (but in general) we get \begin{align} c &= p +(p+i) + (p+2i) + \dots + (p+(n-1)i)\\ & = np +i(1+2+3+\dots+n-1)\\ & = np +i\frac{(n-1)n}{2}\\ & = \frac{n}{2}\left(2p+i(n-1)\right) \end{align} So now we want to solve for $n$ given some cash $c$ available, we get \begin{align} 2c = n\left(2p+in-i\right) &\color{blue}{\implies}n^2(i) + n\left(2p-\frac{2}{2}i\right) = 2\frac{c}{i} \\ &\color{blue}{\implies}n^2 + 2n\left(\frac{p}{i}-\frac{1}{2}\right) +\color{green}{\left(\frac{p}{i}-\frac{1}{2}\right)^2} = 2\frac{c}{i}+\color{green}{\left(\frac{p}{i}-\frac{1}{2}\right)^2}\\ &\color{blue}{\implies} \left\vert n +\frac{p}{i}-\frac{1}{2} \right\vert^2 = 2\frac{c}{i}+\left(\frac{p}{i}-\frac{1}{2}\right)^2\\ &\color{blue}{\implies} n = \frac{1}{2}- \frac{p}{i}\pm\sqrt{2\frac{c}{i}+\left(\frac{p}{i}-\frac{1}{2}\right)^2}\\ &\color{blue}{\implies} n =\frac{i - 2p\pm\sqrt{8ci+\left(2p-i\right)^2}}{2i} \end{align} So since we're looking or the maximum number $n$ possible, we get $$ n = \left\lfloor\frac{i - 2p+\sqrt{8ci+\left(i-2p\right)^2}}{2i} \right\rfloor $$ where $\lfloor \cdot \rfloor$ indicates the floor function.

In your case, plugging in $c = 2000$, $p=20$ and $i=0.01$ gives you the maximum gold amount $n$ you can buy.

$\endgroup$
2
  • $\begingroup$ Thank you, the accuracy is fantastic. I am still learning the formula. Anyway, how do you get this =𝑛2(2𝑝+𝑖(𝑛−1)) $\endgroup$
    – Bobby
    May 15, 2022 at 20:59
  • $\begingroup$ From the previous equation, we have \begin{align}np+i\frac{(n-1)n}{2} &=\color{blue}{\frac{2}{2}}np+i\frac{(n-1)n}{2} \\&=\color{purple}{\frac{n}{2}}2p + \color{purple}{\frac{n}{2}}i(n-1)\\ & =\color{purple}{\frac{n}{2}}\left( 2p + i(n-1)\right) \end{align} $\endgroup$
    – Robert Lee
    May 15, 2022 at 21:59
0
$\begingroup$

As observed correctly, the price follows an arithmetic progression.

Hence, we can equate
$$2000 = S_n \quad (S_n = \text{total price to buy} \; n \; \text{gold})$$ $$\therefore 2000 = \frac{n}{2}(2\cdot20 + 0.01(n-1)) = \frac{n}{2}(0.01n + 39.99)$$ $$\therefore 4000 = 0.01n^2 + 39.99n \iff n^2 + 3999n - 400000 = 0$$

Can you take it from here?

$\endgroup$
4
  • $\begingroup$ Hi, I understand the calculation. Anyway, what formula do you use. Anyway, how many gold we can buy. I am going to analyse it. $\endgroup$
    – Bobby
    May 15, 2022 at 17:53
  • $\begingroup$ @BobbyJulian The same formula you use $-$ $\text{sum} = \frac{n}{2}(\text{initial} + u_n) = \frac{n}{2}(\text{initial} + (\text{initial} + (n-1)\cdot\text{diff})) = \frac{n}{2}(2\cdot \text{initial} + (n-1)\cdot\text{diff})$ $\endgroup$
    – user905694
    May 15, 2022 at 17:55
  • $\begingroup$ I am getting stuck here, will be back after watching arithmetic progression. $\endgroup$
    – Bobby
    May 15, 2022 at 18:13
  • $\begingroup$ @BobbyJulian Sure, let me know if you have any questions. $\endgroup$
    – user905694
    May 15, 2022 at 18:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .