All Questions
Tagged with fibonacci-sequence python-3.x
22 questions
2
votes
1
answer
311
views
Python functions that calculate first n terms of a given order of Fibonacci sequences
I have written two functions that calculate the first n terms of a given order o of Fibonacci sequence, and return the result as ...
1
vote
3
answers
198
views
Fibonacci generator python implementation
I wrote this code for a fibonacci sequence generator. Can anyone tell me whether my code is designed well? if not, why?
...
2
votes
2
answers
385
views
Cython Fibonacci Sequence
For my current job, I've been told that soon I'm going to be porting our Python code to Cython, with the intent of performance upgrades. In preparation of that, I've been learning as much about Cython ...
5
votes
2
answers
1k
views
Fibonacci sequence output
Here's the code I'm having trouble shortening. I am currently a beginner in Python 3.x.
...
0
votes
1
answer
109
views
Fibonnaci sequence calculation [closed]
Below are two ways to calculate an element of the Fibonacci series. Can someone please help me understand why fib1 is so much faster (over 60x) than ...
16
votes
5
answers
6k
views
Project Euler # 25 The 1000 digit Fibonacci index
The Fibonacci sequence is defined by the recurrence relation:
Fn = Fn−1 + Fn−2, where F1
= 1 and F2 = 1.
Hence the first 12 terms will be:
F1 = 1
F2 = 1
F3 = 2
F4 = 3
F5 = 5
...
4
votes
4
answers
5k
views
Find the nth term of a sequence that consists of Fibonacci and prime numbers interleaved
I have given a series problem 1,2,1,3,2,5,3,7,5.... in which the odd terms forms the Fibonacci series and even terms form the prime number series. I have to write a code in which I have to find the ...
10
votes
8
answers
7k
views
Python program for fibonacci sequence using a recursive function
A Fibonacci sequence is the integer sequence of 0, 1, 1, 2, 3, 5, 8.....
The first two terms are 0 and ...
3
votes
3
answers
658
views
Calculate the nth Fibonacci number, mod m
I was trying to output F(n) mod m to find the remainder of Fibonacci number, where F(n) could be a very big number:
...
2
votes
1
answer
393
views
Fibonacci sequence binary tree console logger
I wrote code to show the structure of a Fibonacci sequence pattern in a graphical way. First I structure a tree given a variable the user inputs for how many iterations of the sequence they want to ...
6
votes
3
answers
2k
views
Performance of dynamic Fibonacci generator and dead rabbits
I would like to improve my code style and its efficiency.
I'm just moving beyond the standard recursive approach to a lot of simple algorithms.
This post has two code snippets with slightly ...
4
votes
2
answers
1k
views
Huge Fibonacci modulo m optimization in Python 3
I'm doing some an Algorithm Design online course as a way of learning algorithms and Python as well. One of these challenges requires that I write code for finding a "Huge Fibonacci Number Modulo m". ...
4
votes
1
answer
2k
views
Python3 Terminal Based 'Combat' System
This is my first leap into Python and I had a lot of fun writing this - it is not complete yet.
I'm interested in adding a perk system next, instead of generically increasing stats I'd like the ...
1
vote
1
answer
402
views
Name scope for memoization Fibonacci [closed]
Here's a snippet of code I use to examine the functionality of Python decorator(@memorize). An example of Fibonacci computation:
...
12
votes
6
answers
4k
views
Python 3 - Fibonacci Implementation
I wrote a function returning the n-th Fibonacci number in Python 3:
...