Skip to main content
8 votes
1 answer
266 views

How can I calculate Nth term in Fibonacci sequence of order K efficiently? For example, Tribonacci is Fibonacci order 3, Tetranacci is Fibonacci order 4, Pentanacci is Fibonacci order 5, and Hexanacci ...
Ξένη Γήινος's user avatar
3 votes
2 answers
250 views

The closed-form of the Fibonacci series is the following: As you can see the expression contains square roots so we cannot use it directly to generate Nth Fibonacci number exactly, as sqrt(5) is ...
Ξένη Γήινος's user avatar
0 votes
1 answer
105 views

These operations take priority: If A1 Prime: subtract previous prime (if 1 treat as odd number) If A1 Perfect Square: square root While these are the conditions if those aren't true: If A1 Even: ...
Carlo's user avatar
  • 1
1 vote
3 answers
132 views

I want to write a function that returns a number based on the fibonacci rule where each new number returned is based on the sum of the two previous numbers 1, 1, 2, 3, 5, etc. So if the user inputs 4, ...
lunarchild's user avatar
1 vote
2 answers
98 views

Each method is getting large variations in computation time, even with lots of repeats (to obtain a mean). The effect appears to get worse with larger n. This is my timing code. def timeBlock(func, n,...
Lockyli's user avatar
  • 19
1 vote
2 answers
177 views

From Structure and Implementation of Computer Programs, second edition: Exercise 1.19: There is a clever algorithm for computing the Fibonacci numbers in a logarithmic number of steps.Recall the ...
Tina Russell's user avatar
4 votes
3 answers
266 views

Question: I have a program that calculates the Fibonacci number. When I set a large number of passes, it runs extremely slow because it only works with 1 CPU core, I want to know how to make it ...
user29362427's user avatar
1 vote
2 answers
110 views

I was solving a test on an online platform and the problem statement was similar to this. Stuart has to go from one place to other (A-> B) and he can jump either 1 step, 2 step or 3 steps at a time....
ABGR's user avatar
  • 5,263
1 vote
1 answer
92 views

i´ve written a code in assembly that recursively calculates the fibonacci sequence for a number. the code is for a RISC V processor. The code works correctly for the numbers 1 and 2 but everything ...
Ali Yildiz's user avatar
0 votes
0 answers
39 views

I'm learning 8086 assembly through college course and i ran into a problem. I'm trying to calculate Fibonacci sequence to 46 places but 16-bits registers inside this processors can't handle large ...
Crisiroid's user avatar
-1 votes
3 answers
204 views

I'm trying to make a class that generates a Fibonacci sequence. My two modules are below, the fibonacci.py module and the test_fibonacci.py module. The first two tests pass but the third one seems to ...
JSO's user avatar
  • 21
1 vote
2 answers
124 views

Question: Is it possible to compute the nth Fibonacci number using forward recursion with memoization? If so, how? If not, why not? Context: Most learning resources and books (e.g., CLRS, DPV, etc.) ...
Daniel W. Farlow's user avatar
0 votes
0 answers
61 views

I am using x86 assembly MASM to compute first 41 fibonacci numbers. I initially had an array set to size 41, with 0's. This causes correct output for first 10ish values, with remaining indices being ...
newGuy77's user avatar
-1 votes
1 answer
101 views

I have this Fibonacci script #!/bin/bash if (test $# -ne 1) then echo "Use: $0 number" exit 1 fi for c in ‘seq 1 $1‘ do if (($c == 1)) then n0=1; echo "fibonacci(1)=$n0"; ...
Gigi's user avatar
  • 111
0 votes
1 answer
77 views

I tried to solve Fibonacci series problem in rust, but unfortunately it always return me exponent of 2^n. Here is my code: use std::io; // Fibonacci Series Number // F(n) = 1,1,2,3,5,8,13,....(n-1),((...
user avatar

15 30 50 per page
1
2 3 4 5
159