Personally I love programming and although I've never been in a chair since I started programming computers have troubled me for making my pc run my creative ideas with the collaboration of a person (Jorge Ardila) met the schedule and with the help of a lot of creativity and a bit of reading I managed to do very interesting things within those things my undergraduate thesis (an application of Matlab for the study of conics), plus I joined the Project Euler is a very interesting challenge for those of us in the algorithm. The fact is that after years programming in my own way (sitting in front of the pc more than an idea without a language and a couple of books) the Euler project has taught me that it is better to start thinking about the idea and creativity not only exploit but the algorithm generated other ideas, in particular, last night to face the Euler Project Problem 25 I found a surprise. Resa Problem 25 (in summary):
The tenth second term in the Fibonacci series is the first to have three digits, and the question is which is the first term of the series that has 1000 digits.
As usual, with the clear objective I sat opposite to my super computer and I started thinking about how to achieve the goal, my first thought was to lay down one by one each term of the Fibonacci series and count how many digits each term has so that the program would end when you find the first term of 1000 digits, so I did, a few lines of code, a couple of tests and everything was ready, I started doing walking, I saw that it took too long but I stopped because I knew my other algorithms have been taken up to two hours to find the answer, but reached a point where my intuition more than my impatience led me to stop process, and go off to rest.
Today when I wake up first thing I did was sit back with my super friend and start breaking down what was happening, I began to test my algorithm gradually increasing the number of digits 100, 200, 300, 400 and started late, I stopped because I knew that the beginning of the delay was between 300 and 400, new test at 350 and nothing (demora. ..), then started increasing digit by digit from 300, 301, 302, ... 309 and all good but ... at 310, delay. Well, I decided to make the calculation of the term with 310 digits to pedal, then take the general form of the Fibonacci series and looked for calculating the first term with 310 digits, INF response, ie after the end with 309 digits, the sum is too large to be calculated, that means ups think of another way to tackle the problem.
then I started making a list of items from the number of digits and I found the feature that allowed me to determine my model. The thing is, determining the number of digits that must have a term specific Fibonnacci series can be determined that the first term to have one digit more than the previous 5 positions below this for example the term with 9 digits is at position 40 and 10-digit term is in position 45 However, each 5-digit increases only four positions, ie the term 14 is in position 64, after that term again adding 5 positions for each digit, but curiosity can be more easily seen in the table below
| # Digit Position # Digits | Position | ||
| 9 | 40 | 29 | 136 |
| 10 | 45 | 30 | 141 |
| 11 | 50 | 31 | 146 |
| 12 | 55 | 32 | 151 |
| 13 | 60 | 33 | 155 |
| 14 | 64 | 34 | 160 |
| 15 | 69 | 35 | 165 |
| 16 | 74 | 36 | 170 |
| 17 | 79 | 37 | 174 |
| 18 | 84 | +5=42 | +24=198 |
| 19 | 88 | +5=47 | +24=222 |
| 20 | 93 | +4=51 | +19=241 |
| 21 | 98 | +10=61 | +48=289 |
| 22 | 103 | +4=65 | +19=308 |
| 23 | 107 | +14=79 | +67=375 |
| 24 | 112 | +28=107 | +134=509 |
| 25 | 117 | +28=135 | +134=643 |
| 26 | 122 | ||
| 27 127 | |||
| 28 131 |
then I found some patterns that allow modeling the behavior of the Fibonacci series with respect to at least number of digits of each term, the model is: the first five digits are the previous positions twenty-four forward, but every fourteen digits, only four positions increases which leads us to create a model in which every 28 134 positions digit increases.
This was very easy to make a script which could find the first term to have more than 1000 digits (1003) and the first being close to a thousand digits but below a thousand (975), with this and the application logic of the model found it was easy and fast response.
CONCLUSION: Sometimes
worth thinking about the question on how to answer it.