All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers > Sequences
Fibonacci but with Subtraction still stays Positive (Posted on 2023-02-15) Difficulty: 3 of 5
Let D[n] be a sequence whose values are recursively related by D[n] = D[n-2] - D[n-1].

D[1] is fixed to be equal to 1. Most choices of D[2] will result in a sequence which eventually has some n such that D[n] is negative.

What is the set of values for D[2] exist such that all terms of D[n] are positive?

See The Solution Submitted by Brian Smith    
Rating: 4.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution solution | Comment 2 of 3 |
delta=.0000001;
for d2=0.61802:delta:0.61804
   a=1;b=d2;
   for step=3:100
      c=a-b;
      if c<0 || step ==100
         disp([d2 step c])
         break
      end
      a=b;b=c;
   end
end

is the final narrowing in of where the result is locaated. As you can see the narrowing has brought it in to bracket phi - 1, which is the same as 1/phi.

The narrowing was done by looking for the least absolute value among the output data, which were all negaative, among the longest number of steps to get to the negative value.

Then using only 1/phi with the following replacement line:

for d2=2/(1+sqrt(5)) 

it took 42 steps to get to a negative value, which can be attributed to rounding error.

The sequence:

1, phi-1, 2-phi, 2*phi-3, 5-3*phi, -8+5*phi, ...

where each term (i, starting at 1) is (-1)^(i-1) * (F(i)-F(i-1)*phi)

  Posted by Charlie on 2023-02-15 17:13:49
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (9)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information