Post Reply 
Small challenge
09-20-2017, 07:33 PM (This post was last modified: 09-20-2017 07:56 PM by Dieter.)
Post: #2
RE: Small challenge
(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
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Small challenge - Pekis - 09-20-2017, 06:43 PM
RE: Small challenge - Dieter - 09-20-2017 07:33 PM
RE: Small challenge - Didier Lachieze - 09-20-2017, 07:49 PM
RE: Small challenge - Pekis - 09-20-2017, 07:54 PM
RE: Small challenge - Dieter - 09-20-2017, 08:00 PM
RE: Small challenge - Joe Horn - 09-20-2017, 08:05 PM
RE: Small challenge - AlexFekken - 09-20-2017, 10:57 PM
RE: Small challenge - SlideRule - 09-20-2017, 11:52 PM
RE: Small challenge - AlexFekken - 09-20-2017, 10:51 PM



User(s) browsing this thread: 1 Guest(s)