1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lys-0071 [83]
3 years ago
8

The Fibonacci sequence 1, 1, 2, 3, 5, 8, 13, 21…… starts with two 1s, and each term afterward is the sum of its two predecessors

. Please write a function, Fib(n), which takes n as the input parameter. It will return the n-th number in the Fibonacci sequence. Using R, the output for Fib(9) should give only the 9th element in the sequence and not any of the previous elements. Please Help :)
Engineering
2 answers:
Novay_Z [31]3 years ago
5 0

9th value is 34

Explanation:

R or Fib (n) function is given by: (n - 1) + (n - 2), where n is the number in the Fibonacci sequence .

Hence, fib (9) = (9 - 1) + (9 - 2)

                      = 8th value + 7th value on the sequence summed together  

<em>Fibonacci sequence: 1, 1, 2, 3, 5, 8, 13, 21.</em><em> </em>The 8th value is 21 and the 7th value is 13.  

R = (n - 1) + (n - 2)

R (9) 0r Fib (9) = 21 + 13

           = 34

Olin [163]3 years ago
5 0
<h2>Answer:</h2>

  #Create a function Fib to return the nth term of the fibonacci series

  #Method header declaration

   Fib <- function(n)  {

 

   #when n <= 1, the fibonacci number is 1

   #hence return 1

   if (n <= 1)

           return(1)

   #when n = 2, the fibonacci number is 1

   #hence return 1

   else if (n == 2)

            return(1)

   

   #at other terms, fibonacci number is the sum of the previous two

   #numbers.

   #hence return the sum of the fibonacci of the previous two numbers

   else

           return( Fib(n-1) + Fib(n-2))

   }    #End of method.

============================================================

<h2>Sample Output:</h2>

A call to Fib(9) will give the following output:

>> 34

============================================================

<h2>Explanation:</h2>

The above program has been written in R language and it contains comments explaining each of the lines of code. Please go through the comments in the code.

For readability, the actual lines of code have been written in bold face to distinguish them from the comments.

You might be interested in
Technician A ay that acid rain doe the mot harm when it firt fall on a finih. Technician B ay that hard water potting i uually j
Tamiku [17]

Technician B is right say that hard water potting i usually jut a Surface problem that can be wahed off.

What do you mean by Hard water?

The amount of dissolved calcium and magnesium in the water determines its hardness. Calcium and magnesium are the main dissolved minerals in hard water. The last time you washed your hands, you might have actually felt the effects of hard water.

What do you mean by acid rain?

Any type of precipitation that contains acidic elements, such as sulfuric or nitric acid, that falls to the ground from the atmosphere in wet or dry forms is referred to as acid rain, also known as acid deposition. Rain, snow, fog, hail, and even acidic dust can fall under this category.

Some plants are sensitive to excessive moisture around their root zone, so it may be necessary to increase drainage when growing plants in pots. Additionally, standing water at the bottom of the pot can cause root rot.

Many university agriculture extension agencies have thoroughly debunked the old garden myth that adding rocks to the bottom of a pot will increase drainage.

Learn more about hard water click here:

brainly.com/question/28178305

#SPJ4

6 0
1 year ago
Which starting circuit uses fuses, switches, and smaller wires to energize a relay and solenoid?
zysi [14]

Answer:

Option B (Starter Control Circuit) is the right option.

Explanation:

  • This same switching is normally put upon this isolated side of something like the transmission Arduino microcontroller throughout the configuration that is using the ignition just to command the broadcast.
  • It uses a secondary relay isolated to regulate electrical current throughout the solenoid starting system.

All other given options are not related to the given instance. So the above option is correct.

4 0
2 years ago
How can I use the flux density B formula if I don’t know magnetic flux
BabaBlast [244]

Answer:

use the dimensions shown in the figure

3 0
3 years ago
What is the answer ?
tigry1 [53]
Is the control group
4 0
3 years ago
Why was Tetris so popular and use evidence from the text ito support your resp
Softa [21]

Answer:

because it was a cool game at that time

Explanation: u didnt give us any text

pls mark brainliest

4 0
2 years ago
Other questions:
  • What kind of energy transformation happens when a boy uses energy from a sandwich to run a race​
    11·2 answers
  • Intravenous infusions are usually driven by gravity by hanging the bottle at a sufficient height to counteract the blood pressur
    11·1 answer
  • Although the viscoelastic response of a polymer can be very complex (time-dependent stress cycling for instance), two special lo
    11·1 answer
  • An 80-percent-efficient pump with a power input of 20 hp is pumping water from a lake to a nearby pool at a rate of 1.5 ft3/s th
    14·1 answer
  • How may a Professional Engineer provide notice of licensure to clients?
    9·1 answer
  • "It is better to be a human being dissatisfied than a pig satisfied; better to be Socrates dissatisfied than a fool satisfied. A
    7·1 answer
  • Suggest how the following requirements might be rewritten in a
    8·1 answer
  • How can you drop two eggs the feweHow can you drop two eggs the fewest amount of times, without them breaking? ...st amount of t
    13·2 answers
  • Which option identifies the type of engineering technician most likely to be involved in the following scenario?
    9·1 answer
  • There are signs of oil spray on the compressor clutch hub and nearby underhood areas. Technician A says that a faulty compressor
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!