Small challenge - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: Small challenge (/thread-9126.html) |
Small challenge - Pekis - 09-20-2017 06:43 PM - "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. RE: Small challenge - Dieter - 09-20-2017 07:33 PM (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 ..." 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 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 Is this what you were looking for? Dieter RE: Small challenge - Didier Lachieze - 09-20-2017 07:49 PM (09-20-2017 06:43 PM)Pekis Wrote: - "Hi, old chap, can you lend me 6000 $ ?" 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: RE: Small challenge - Pekis - 09-20-2017 07:54 PM 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 Thanks ! RE: Small challenge - Dieter - 09-20-2017 08:00 PM (09-20-2017 07:54 PM)Pekis Wrote: Thanks for your enlighting answer ! I finally added this as a "special case". Before I read Didier's and your reply. Really. ;-) Dieter RE: Small challenge - Joe Horn - 09-20-2017 08:05 PM My favorite solution is: first payment is $250.12, and each month's payment after that is one penny less. RE: Small challenge - AlexFekken - 09-20-2017 10:51 PM 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. RE: Small challenge - AlexFekken - 09-20-2017 10:57 PM (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 :-) RE: Small challenge - SlideRule - 09-20-2017 11:52 PM (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 |