![]() ![]() Have you noticed that when our n value is too high, the program will slow down? But, well, as you might have guessed, I'm going to say but. Compared with the recursion is not too strange to everyone, then according to the above mathematical formula we get, deducing such recursive pseudocode will be very simple and clear. For the pseudo-code of rabbit problem, we use the recursive method of the above formula here, and the pseudo-code can be as follows:Īccording to the recursion concept described in the previous article, you can refer to the previous "Tower of Hannock Problem" for details. Pseudocode is not real code that can't be executed on a machine, but is a meaningful symbol between a natural language and a programming language that expresses program logic. ![]() ![]() That's right, it's expressed in 1 sentence, starting with the third term, the sum of the first two terms is equal to the third term.Īssuming that the value of n is fn, the regularity of the sequence is expressed by the mathematical formula as follows: Geometric? Arithmetic? Or something else? Since this is a problem posed by a mathematician, there must be a definite mathematical law in it, right? What is the pattern? Take a closer look at the first sequence of numbers and you have the answer. It's hard to find a pattern when we get to this problem somehow, but think about it in terms of the sequence of numbers in mathematics. Note: the new baby will not be put into production until it has grown for 1 month! And these rabbits are immortal!! We express it mathematically, as follows: At the beginning, there was only one free seed, after one month, there were two free seeds, after two months, there were three free seeds, after three months, five free seeds (small free seeds into production). The problem with this technique is that if a baby is born every month, the baby will start to give birth after a month. The rabbit problem, a visualization of the Fay sequence, is a problem posed by a mathematician named Fibonacci in his work. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |