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
Read two numbers from user input. Then, print the sum of those numbers. Hint -- Copy/paste the following code, then just type co
Softa [21]

Answer:

I am Providing Answer in C Language Program.

Explanation:

Please find attachment regarding code of taking two numbers input and adding them.

I would like to recommend you please use software which supports C language.

#include <stdio.h>

int main () {

int a, b, sum;

printf ("\ nEnter two no:");

scanf ("% d% d", & d, & e);

sum1 = d + e;

printf ("Sum:% d", sum1);

return (0);

}

4 0
3 years ago
You want to plate a steel part having a surface area of 160 with a 0.002--thick layer of lead. The atomic mass of lead is 207.19
Pepsi [2]

Answer:

<u><em>To answer this question we assumed that the area units and the thickness units are given in inches.</em></u>

The number of atoms of lead required is 1.73x10²³.    

Explanation:

To find the number of atoms of lead we need to find first the volume of the plate:

V = A*t

<u>Where</u>:

A: is the surface area = 160

t: is the thickness = 0.002

<u><em>Assuming that the units given above are in inches we proceed to calculate the volume: </em></u>

V = A*t = 160 in^{2}*0.002 in = 0.32 in^{3}*(\frac{2.54 cm}{1 in})^{3} = 5.24 cm^{3}    

Now, using the density we can find the mass:

m = d*V = 11.36 g/cm^{3}*5.24 cm^{3} = 59.5 g

Finally, with the Avogadros number (N_{A}) and with the atomic mass (A) we can find the number of atoms (N):

N = \frac{m*N_{A}}{A} = \frac{59.5 g*6.022 \cdot 10^{23} atoms/mol}{207.19 g/mol} = 1.73 \cdot 10^{23} atoms    

Hence, the number of atoms of lead required is 1.73x10²³.

I hope it helps you!

3 0
3 years ago
Select the correct answer.
cricket20 [7]

Answer:

A.

The power generated by a wind farm is not constant because of irregular wind patterns.

5 0
3 years ago
Select four types of engineers who might be involved in the development of a product such as an iPhone.
Bas_tet [7]

Answer:

electrical

computer

mechanical

and manufacturing .... I think

4 0
3 years ago
Read 2 more answers
Railroad tracks made of 1025 steel are to be laid during the time of year when the temperature averages 4C (40F). Of a joint spa
DENIUS [597]

Answer:

41.5° C

Explanation:

Given data :

1025 steel

Temperature = 4°C

allowed joint space = 5.4 mm

length of rails = 11.9 m

<u>Determine the highest possible temperature </u>

coefficient of thermal expansion ( ∝ ) = 12.1 * 10^-6 /°C

Applying thermal strain ( Δl / l )  = ∝ * ΔT

                                    ( 5.4 * 10^-3 / 11.9 )  = 12.1 * 10^-6 * ( T2 - 4 )

∴  ( T2 - 4 ) =  ( 5.4 * 10^-3 / 11.9 ) / 12.1 * 10^-6

hence : T2 = 41.5°C

8 0
3 years ago
Other questions:
  • Air is compressed in the compressor of a turbojet engine. Air enters the compressor at 270 K and 58 kPa and exits the compressor
    13·1 answer
  • A 1 m wide continuous footing is designed to support an axial column load of 250 kN per meter of wall length. The footing is pla
    11·1 answer
  • Is it more difficult to pump oil from a well on dry land or a well under water?Why?
    11·1 answer
  • The fouling on the heat exchanger surfaces causes additional thermal resistance, thus decreases the heat transfer rate. a)- True
    11·1 answer
  • In which of the following states are you most likely to find a home with a basement and why?
    13·1 answer
  • One kg of an idea gas is contained in one side of a well-insulated vessel at 800 kPa. The other side of the vessel is under vacu
    11·1 answer
  • A pipe leads from a storage tank on the roof of a building to the ground floor. The absolute pressure of the water in the storag
    7·1 answer
  • An iron-carbon alloy initially containing 0.286 wt% C is exposed to an oxygen-rich and virtually carbon-free atmosphere at 1200°
    7·1 answer
  • Please choose a specific type of stability or control surface (e.g., a canard) and explain how it is used, what it is used for,
    5·1 answer
  • 1) Which step in the Design Process utilizes technical drawings to provide information necessary to
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!