2,371 questions
Advice
0
votes
4
replies
128
views
Number sequence
This sequence appears to be a complex, hybrid sequence, combining elements of:
Fibonacci sequence
Lucas sequence
Quadratic recurrence sequence
Chaotic sequence (due to the sine wave patterns)
It's ...
Score of 8
1 answer
293 views
Fast calculation of Nth generalized Fibonacci number of order K?
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 ...
Score of 3
2 answers
320 views
Is it possible to use the closed-form of Fibonacci series to generate the Nth Fibonacci number exactly and efficiently?
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 ...
Score of 0
1 answer
116 views
How to make Excel do a different operation in A2 depending on what type of number A1 is?
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: ...
Score of 1
3 answers
159 views
How to return the sum of the two previous numbers?
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, ...
Score of 1
2 answers
114 views
Why is there such large variation in computation time for Fibonacci generation between adjacent values of n?
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,...
Score of 1
2 answers
229 views
SICP exercise 1.19, transformations
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
...
Score of 4
3 answers
297 views
How to use all CPU threads when calculating Fibonacci number?
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 ...
Score of 1
2 answers
130 views
Number of ways to reach A to B by climbing one step, two steps or three steps at a time
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....
Score of 1
1 answer
113 views
Recursive Fibonacci Assembly
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 ...
Score of 0
0 answers
40 views
Calculating Fibonacci Sequence to 46 times or more in 8086 Assembly [duplicate]
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 ...
Score of -1
2 answers
267 views
My class doesn't generate a Fibonacci sequence properly
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 ...
Score of 1
2 answers
137 views
Computing the nth Fibonacci number using forward recursion with memoization
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.) ...
Score of 0
0 answers
64 views
Issues with array size outputting garbage values in assembly
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 ...
Score of -1
1 answer
108 views
Fibonacci script
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";
...