Computer Science, asked by vasanthnaoz, 1 year ago

number of fibonacci sequence 0,1,1,2,3,5,8,13,21,34,55,89,144...are writer in a spiral form starting at (0,0) and moving as shown in diagram below​

Answers

Answered by fiercespartan
4

All the Fibonacci series start from 0,1,1 and the next number is determined  by the sum of the two previous numbers.

For example, in sum 0,1 ; the next number = 0 + 1 = 1

0,1,1 ; next number = 1 + 1 = 2

0,1,1,2 ; next number 1 + 2 = 3

And this series continues.

To do this in the easiest way, we will take an empty list.

Let's say, series = []

And then, as we already know the starting sequence, which is 0 and 1. Let's add them to our list.

series = [0,1]

Now, the trick behind getting the series is adding the last number and the second last number.

To get a last number in the list, we use the index -1. list[-1] and the second last number = list[-2].

And we add a new number which the sum of these two numbers. Here is the enhanced, simple and the smallest code possible to do the Fibonacci series.

First, let's ask the user how many numbers he/she wants in the series.

Here is the code.

CODE:

series = [0,1]

limit = int(input('Enter the limit of the series:'))

while len(series) < limit:

   series.append(series[-1] + series[-2])

print(*[x for x in series],sep=',')

_____________________________________

If the limit is 5, the output would look like:

0,1,1,2,3

Answered by indiabrainly
0

Answer:

Explanation:

A spiral set of numbers starting from zero or one is known as a Fibonacci spiral. The sequence proceeds on the basis that every Fibonacci number is equal to the sum of the two numbers preceding it.

A logarithmic spiral that has a 1+5√21+52 growth factor or golden ratio is known as the Fibonacci spiral. The sequential numbers ratio of Fibonacci sequence approaches golden ration asymptotically.

Similar questions