# Problem 56065. Easy Sequences 74: Fibonacci Bank Account

In fantasy world where money does grow on trees, a man decided to top-up his bank account, daily. On the first day he noticed that he has initial "integer" balance of , so he made his first "integer" deposit of . On the next days, he made deposit equivalent to the day's starting balance plus the amount he deposited on the previous day. This means that on any k-th day the following formula for the amount he would deposit, holds: .
Given that on the n-th day, he made a deposit of , calculate his initial balance , his first deposit , and his final ending balance at the end of the n-th day transaction. It is also known that the first deposit he made () is the smallest possible first deposit to attain at the n-th day, using the above formula.
While the account balances can be negative, deposits are always positive (no withdrawals please).
For example, bank statements if and , are shown below. His first deposit , is the smallest possible first deposit to attain a deposit of on the 5-th day. His starting balance should be , and his ending balance at 5-th day should be .
Since this problem involves unbelievable sums of money, please reduce your answer modulo . Therefore for the above example the final answer should be:
>> k = mod([-30,20,80],2178309)
k =
2178279 20 80
HINT: Use of a big integer arithmetic implementation, is not required in this problem. You can get the modulus using Pisano Period. is the -nd Fibonacci number. Also, the ratio of the day's ending balance to the deposit approaches the Golden Ratio as the values of n gets larger.

### Solution Stats

66.67% Correct | 33.33% Incorrect
Last Solution submitted on Feb 02, 2024

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!