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
What is EL Niño?
postnew [5]

Answer:

B

Explanation:

This occurs over the Pacific Ocean, so C and D are already wrong. El Nino heats the water and not cools it, so A is incorrect. So commonsense says that the answer is B.

4 0
3 years ago
What does abbreviation vom stand for
MrMuchimi
It’s Volt Ohm Meter!
8 0
2 years ago
Read 2 more answers
Twenty-five wooden beams were ordered or a construction project. The sample mean and he sample standard deviation were measured
aksik [14]

Answer:

Correct option: B. 90%

Explanation:

The confidence interval is given by:

CI = [\bar{x} - z\sigma_{\bar{x}} , \bar{x}+z\sigma_{\bar{x}} ]

If \bar{x} is 190, we can find the value of z\sigma_{\bar{x}}:

\bar{x} - z\sigma_{\bar{x}}  = 188.29

190 - z\sigma_{\bar{x}}  = 188.29

z\sigma_{\bar{x}}  = 1.71

Now we need to find the value of \sigma_{\bar{x}}:

\sigma_{\bar{x}} = s / \sqrt{n}

\sigma_{\bar{x}} = 5/ \sqrt{25}

\sigma_{\bar{x}} = 1

So the value of z is 1.71.

Looking at the z-table, the z value that gives a z-score of 1.71 is 0.0436

This value will occur in both sides of the normal curve, so the confidence level is:

CI = 1 - 2*0.0436 = 0.9128 = 91.28\%

The nearest CI in the options is 90%, so the correct option is B.

4 0
3 years ago
How do you solve this. I dont know how so I need steps if you dont mind
galben [10]

Explanation:

all I know is every number that have a bar on is equal to one

4 0
2 years ago
Wastewater flows into a _________ once it is released into a floor drain.
rodikova [14]

Answer:

A) Sump pit

Explanation:

A wastewater typically refers to a body of water that has contaminated through human use in homes, offices, schools, businesses etc. Wastewater are meant to be disposed in accordance with the local regulations and standards because they are unhygienic for human consumption or use.

Generally, many homes use a floor drain in their bathrooms and toilets to remove wastewater in order to mitigate stagnation and to improve hygiene. A floor drain can be defined as a material installed on floors for the continuous removal of any stagnant wastewater in buildings. Wastewater flows into a sump pit once it is released into a floor drain through the use of a pipe such as a polyvinyl chloride (PVC) pipe, which directly connects the floor drain to the sump pit. The wastewater can the be removed from the sump pit when it is filled up through the use of a pump.

6 0
3 years ago
Other questions:
  • The function of a circuit breaker is to _____.
    12·1 answer
  • Find the inductive reactance per mile of a single-phase overhead transmission line operating at 60 Hz, given the conductors to b
    6·1 answer
  • What is the ILS stand for
    8·2 answers
  • Problem 89:A given load is driven by a 480 V six-pole 150 hp three-phase synchronous motor with the following load and motor dat
    11·1 answer
  • The housing for a certain machinery product is made of two components, both aluminum castings. The larger component has the shap
    10·1 answer
  • Visual aids are useful for all of the following reasons except
    11·1 answer
  • Which statement is true about the future of space travel?
    15·1 answer
  • Why might many general contractors begin their careers as construction workers?
    9·1 answer
  • 'Energy' has the potential to:
    6·1 answer
  • a low velocity fastening system that is used to drive steel pins or threaded studs into a masonry and steel is a
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!