# HP Forums

Full Version: Small challenge
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
- "Hi, old chap, can you lend me 6000 \$ ?"
- "Of course, yes, you can pay me back in two years, with a monthly payment, without any interests but linearly decreasing"
- "Thanks a lot !" he said, putting the 6000 \$ in his pocket

But back home, he was wondering, "How much shall I have to pay him each month ? ... Sure it won't be 6000\$ / 24 = 250\$ each month and it will be more than that the first month ..."

How can you help him ? Can you propose a formula for each month ?

Have fun.
(09-20-2017 06:43 PM)Pekis Wrote: [ -> ]But back home, he was wondering, "How much shall I have to pay him each month ? ... Sure it won't be 6000 / 24 = 480 each month and it will be more the first month ..."

How can you help him ? Can you propose a formula for each month ?

First of all: 6000/24 is not 480 but 250. ;-)
And now let me see if I correctly understood the idea.

Every month a certain amount is payed. This amount decreases from month do month by the same delta d.

So in the last month the payment is p.
In the month before the payment is p + d.
In the month before that the payment is p + d + d.
etc.

This can be written as follows:
p + p+d + p+2d + p+3d ... + p+23d = 6000

In other words:
24*p + d*(1+2+3+...+23) = 6000

The sum from 1 to 23 is 23*24/2 = 276.
Or, generally spoken with n months:

n*p + d*(n*(n–1))/2 = 6000

Now you can write
d = (6000 – n*p) / (n*(n–1)) * 2

Or the other way round:
p = (6000 – d*n*(n–1)/2) / n

Since the monthly payments are supposed to decrease, d must be > 0. Looking at the formula for d this means that p must be less than 6000/n = 250.

Otherwise you are free to choose what basic amount (p) you want to pay and by how much (d) the payments differ from month to month. You may start with a high payment which is substantially decreased each month, or you may start with a lower initial payment which descreass only gradually. In any case your last payment will be p and you start with p+(n–1)*d.

Example:
As shown above, p must be less than 250. Let's say p=200. This means that according to the formula above d is 4,3478, or roughly 4,35.

The payment in month i (i=1...n) is p + (n–i)*d

Here is a table (based on the exact d-value of 4,347826...)

Code:
```month  initial     monthly   remaining  no.   debt        payment   debt --------------------------------------  1     6.000,00     300,00    5.700,00  2     5.700,00     295,65    5.404,35  3     5.404,35     291,30    5.113,04  4     5.113,04     286,96    4.826,09  5     4.826,09     282,61    4.543,48  6     4.543,48     278,26    4.265,22  7     4.265,22     273,91    3.991,30  8     3.991,30     269,57    3.721,74  9     3.721,74     265,22    3.456,52 10     3.456,52     260,87    3.195,65 11     3.195,65     256,52    2.939,13 12     2.939,13     252,17    2.686,96 13     2.686,96     247,83    2.439,13 14     2.439,13     243,48    2.195,65 15     2.195,65     239,13    1.956,52 16     1.956,52     234,78    1.721,74 17     1.721,74     230,43    1.491,30 18     1.491,30     226,09    1.265,22 19     1.265,22     221,74    1.043,48 20     1.043,48     217,39      826,09 21       826,09     213,04      613,04 22       613,04     208,70      404,35 23       404,35     204,35      200,00 24       200,00     200,00        0,00```

So you start with a 300,- payment and end up with 200,-.

So the procedure is as follows:
Define your last payment p and calculate d from this. Here d = (6000 – n*p) / (n*(n–1)) * 2.
- or -
Define the payment delta d and calculate p from this. Here p = (6000 – d*n*(n–1)/2) / n.

Then your payment in month i is p + (n–i)*d.

Special case:
In the above formulas you may increase n by 1 and set p=0. Then the last payment is close to zero (actually the n+1st would be zero).
For the example this leads to d = 6000/(24*25/2) = 20 and the payments are 24*20=480, 23*20=460, ... , 2*20=40, 1*20=20.

Code:
```month  initial     monthly   remaining  no.   debt        payment   debt --------------------------------------  1     6.000,00    480,00    5.520,00  2     5.520,00    460,00    5.060,00  3     5.060,00    440,00    4.620,00  4     4.620,00    420,00    4.200,00  5     4.200,00    400,00    3.800,00  6     3.800,00    380,00    3.420,00  7     3.420,00    360,00    3.060,00  8     3.060,00    340,00    2.720,00  9     2.720,00    320,00    2.400,00 10     2.400,00    300,00    2.100,00 11     2.100,00    280,00    1.820,00 12     1.820,00    260,00    1.560,00 13     1.560,00    240,00    1.320,00 14     1.320,00    220,00    1.100,00 15     1.100,00    200,00      900,00 16       900,00    180,00      720,00 17       720,00    160,00      560,00 18       560,00    140,00      420,00 19       420,00    120,00      300,00 20       300,00    100,00      200,00 21       200,00     80,00      120,00 22       120,00     60,00       60,00 23        60,00     40,00       20,00 24        20,00     20,00        0,00```

Is this what you were looking for?

Dieter
(09-20-2017 06:43 PM)Pekis Wrote: [ -> ]- "Hi, old chap, can you lend me 6000 \$ ?"
- "Of course, yes, you can pay me back in two years, with a monthly payment, without any interests but linearly decreasing"

So the total amount over 24 month is 6000 and it's decreasing by a constant amount a each month. So 6000=a*(24*(24+1)/2) or 6000=a*300 or a=20.
The first month payment is \$480 (20*24), decreasing by \$20 every month.

Code:
```    1    480     480  2    460     940  3    440    1380  4    420    1800  5    400    2200  6    380    2580  7    360    2940  8    340    3280  9    320    3600 10    300    3900 11    280    4180 12    260    4440 13    240    4680 14    220    4900 15    200    5100 16    180    5280 17    160    5440 18    140    5580 19    120    5700 20    100    5800 21     80    5880 22     60    5940 23     40    5980 24     20    6000```
I had imagined only one solution:
M=amount to pay=6000
n=number of payments=24
i=number of the payment: i=1..n
Payement number i= 2/n*(1-i/(n+1)) * M
So it began with 480 and ended up with 20
Thanks !
(09-20-2017 07:54 PM)Pekis Wrote: [ -> ]Thanks for your enlighting answer !
I had imagined only one solution:
M=amount to pay=6000
n=number of payments=24
i=number of the payment: i=1..n
Payement number i= 2/n*(1-i/(n+1)) * M
So it began with 480 and ended up with 20

I finally added this as a "special case".

Dieter
My favorite solution is: first payment is \$250.12, and each month's payment after that is one penny less.
No need to sum the series: because of the linearity the average payment needs to be 250 and that will be the "virtual payment" at month 12.5. So if the delta is d then the payments of month 12 and 13 should be 250 + d/2 and 250 - d/2 etc... Just need to make sure that the last payment will be positive then, i.e. 250 - 11.5 *d > 0.
(09-20-2017 08:05 PM)Joe Horn Wrote: [ -> ]My favorite solution is: first payment is \$250.12, and each month's payment after that is one penny less.
You'll be paying too much then: you'd have to start with \$250.115. Had to fix more or less the same mistake in my solution :-)
(09-20-2017 08:05 PM)Joe Horn Wrote: [ -> ]... first payment is \$250.12, and each month's payment after that is one penny less...

OR, skip the central payment (\$ 250.00) with +12 above and -12 below, as in the following table:
\$250.12
\$250.11
\$250.10
\$250.09
\$250.08
\$250.07
\$250.06
\$250.05
\$250.04
\$250.03
\$250.02
\$250.01...∑ (1-12)=\$3,000.78
\$249.99
\$249.98
\$249.97
\$249.96
\$249.95
\$249.94
\$249.93
\$249.92
\$249.91
\$249.90
\$249.89
\$249.88...∑ (13-24)=\$2,999.22

therefore.∑ (01-24)=\$6,000.00

I do like the approach, it has a simple elegance.

BEST!
SlideRule
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :