A Texas oilman who was an amateur number theorist opened a new bank account by depositing a certain integral number of dollars, which we shall call x.
His second deposit, y, also was an integral number of dollars.
Thereafter each deposit was the sum of the two previous deposits.
(In other words, his deposits formed a generalized Fibonacci series.)
His 20th deposit was exactly a million dollars.
What are the values of x and y, his first two deposits?
Source: problem by Leonard A. Monzert
Dividing 1,000,000 by phi^18, rounded gives 173; dividing by phi again, rounded gives 107. But starting with 107 and 173 results in a 20th deposit of only 999,801.
Playing around by fiddling with the two numbers 107 and 173 doesn't seem to produce the desired 1,000,000, so a different tack is needed:
Working the other way around, assume the 19th deposit is 1,000,000 / phi, rounded, or 618034. Then work backwards, subtracting 618034 from 1,000,000, etc., each time subtracting the newly found value from the previously found value.
Working backward, via subtraction, from the 18th to the 1st deposit:
So the first two deposits were $154 and $144 respectively.
BTW, doing the same while assuming a 19th deposit of merely one dollar more or less away from 618,034 would result in a couple of negative values along the way, so this solution is it, exactly.
OPEN "20dep.txt" FOR OUTPUT AS #2
c = 1000000
b = 618034
FOR n = 18 TO 1 STEP -1
a = c - b: PRINT #2, a
c = b: b = a
Posted by Charlie
on 2016-01-04 15:33:04