Skip to main content

All Questions

Filter by
Sorted by
Tagged with
4 votes
2 answers
1k views

Recursive vs. non-recursive implementations of Fibonacci sequence

I have 2 functions to get the n-th fibonacci number. The 1st one uses recursive calls to calculate the power(M, n), while the 2nd function uses iterative approach for power(M, n). Theoretically (at ...
NepNep's user avatar
  • 301
0 votes
1 answer
108 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 ...
psyco's user avatar
  • 3
12 votes
6 answers
4k views

Python 3 - Fibonacci Implementation

I wrote a function returning the n-th Fibonacci number in Python 3: ...
user7802048's user avatar
12 votes
2 answers
5k views

Lovely Lucky LAMBs

I am trying to solve this question from google's foobar. However, my code exceeds the time limit, even though when I tested it I got correct answers. How can I make my code more efficient? Lovely ...
ngmh's user avatar
  • 123
5 votes
5 answers
7k views

Finding large Fibonacci Number in Python

I'm doing Project Euler at 1000-digit Fibonacci number - Problem 25 which says The Fibonacci sequence is defined by the recurrence relation: Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1. ...
user avatar
5 votes
1 answer
755 views

Recursive Fibonacci generator

I decided to write a function that would generate an index of the Fibonacci sequence making use of Python's mutable default parameter. It's inspired by a question I answered on Stack Overflow where ...
SuperBiasedMan's user avatar
7 votes
4 answers
23k views

Fibonacci sum with memoization

Problem: Using the recursion approach, find a Fibonacci sum without repetition of computation. ...
overexchange's user avatar
  • 3,401
5 votes
2 answers
368 views

Comparison of Fibonacci (Multinacci) Functions in Python3

After coming up with a formula on this Stack Overflow question, defeating recursion limits and finding a few new ways of calculating these numbers (as per this Stack Overflow question), I decided that ...
mleyfman's user avatar
  • 5,210