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
Florida's progressive DUI laws take ______<br> into account.
xz_007 [3.2K]

Answer:

Permanent felony conviction on your criminal record.

Financial restitution if DUI involves an accident, property damage or personal injury

Up to 50 hours community service or fee of $10 per hour of service.

Minimum fine of upto $1000 or $2000, that is if your blood alcohol level was 0.15%  or more than this, or you were driving with a minor in the vehicle.

Imprisonment of upto 9 months, if the blood alcohol level was over 0.15% or idf the DUI  resulted in ana accident or crash, jail time is increased to one year.

Mandatory imprisonment for not less than 10 days if your second DUI conviction occurs within 5 years of the date of the prior DUI conviction.

180 days to one year probation.

Maximum of 5 years driver's license revocation.

Up to 30 days impoundment of vehicle.

Ignition interlock device.

Criminal record stating adjudication of guilt.

Explanation:

8 0
3 years ago
Name the seven physical qualities for which standards have been developed.
SIZIF [17.4K]

Answer:

HUMAN DEVELOPMENT

MOTOR BEHAVIOR

EXERCISE SCIENCE

MEASUREMENT AND EVALUATION

HISTORY AND PHILOSOPHY

UNIQUE ATTRIBUTES OF LEARNERS

CURRICULUM THEORY AND DEVELOPMENT

Explanation:

6 0
4 years ago
The tolerance for a geometric can be easily identified by reading the _________.
baherus [9]

Answer:

C

Explanation:

4 0
3 years ago
Read 2 more answers
forty gal/min of a hydrocarbon fuel having a spesific gravity of 0.91 flow into a tank truck with load limit of 40,000 lb of fue
Zina [86]

Answer: 131.75minutes

Explanation:

First if all, we've to find the density of liquid which will be:

= Specific gravity × Density to pure water

= 0.91 × 8.34lb/gallon

= 7.59lb/gallon

Then, the volume that's required to fill the tank will be:

= Load limit/Density of fluid

= 40000/7.59

= 5270.1gallon

Now, the time taken will be:

= V/F

= 5270.1/40

= 131.75min

It'll take 131.75 minutes to fill the tank in the truck.

5 0
3 years ago
In a Series circuit with two identical loads, the voltage across each load will be:
mel-nik [20]
<h3>Option A</h3>

In a Series circuit with two identical loads, the voltage across each load will be:  the same

<h3><u>Explanation:</u></h3>

A series circuit is one with total the loads in a row. There is barely ONE path for electricity to pass. If this circuit was a series of flashbulbs, and one left out, the left bulbs would switch off. T

he current in a series circuit is universally the same and the voltage over the circuit is the amount of the unique voltage drops over each component. The voltage referred to as a series circuit is equivalent to the amount of the individual voltage drops.

8 0
3 years ago
Other questions:
  • A meter stick can be read to the nearest millimeter and a travelling microscope can be read to the nearest 0.1 mm. Suppose you w
    11·1 answer
  • A 15 Watt desk-type fluorescent lamp has an effective resistance of 200 ohms when operating (note: the 15 Watts is only associat
    13·1 answer
  • Consider a two-dimensional incompressible velocity potential phi = ???????? cos theta + ????????theta, where B and L are constan
    8·1 answer
  • Based on parameters such as the materials shear modulus, diameter of the wire, mean coil diameter, and number of active coils (a
    11·1 answer
  • A turbine blade made of a metal alloy (k = 17 W/m·K) has a length of 5.3 cm, a perimeter of 11 cm, and a cross-sectional area of
    15·1 answer
  • The following is a list of metals and alloys:
    10·1 answer
  • The nuclear reactions resulting from thermal neutron absorption in boron and cadmium are 10B5 + 1 n0 ï  7Li3 + 4He2 113Cd48 + 1
    9·1 answer
  • A farmer has 19 sheep on his land. One day, a big storm hits and all but seven run away. How many sheep does the farmer have lef
    10·1 answer
  • Also discuss how bandwidth is affected by increasing the number of signal elements.
    5·1 answer
  • 1. A car engine transfers 3000J in 20 seconds. What is the power generated by the engine?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!