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
There is evidence that liquid water existed on Mars at some time in the past. What is the evidence found indicating the presence
Norma-Jean [14]
There mag be water on Mars but it’s not very easy to spot, but that is besides the point,

Mars is a smaller planet then Earth, thus it has less gravity, meaning when water evaporates into the atmosphere of the planet the water slowly escapes into space, so there is less and less water on the planet.

Hope this helps!
5 0
3 years ago
Question #8
iris [78.8K]

Problem solving is the act of orderly searching for solutions to problem

The correct option that involves approaching a problem in a new way is the option;

Creative thinking

The reasons why creative thinking is the correct option is given as follows;

Finding new ways to approach a problem, involves considering alternatives to already known approaches to the problem

Given that the options to be considered are to be options which have not been applied, then the process does not involve;

Context: Which looks at the variables that relate the problem with setting or circumstance that aid understanding of the problem

Critical thinking; Which is based on the analysis of the known facts, but the new proposals are required

Perseverance; Which involves adherence to a particular option despite delay or difficulty

However;

Creative thinking; Creative thinking involves the consideration of a situation thing or problem in a new way or by approaching a task differently than what was considered a regular approach, which involves finding an unused or imaginative approach to a problem

Therefore;

The option that involves finding new ways to approach a problem is <u>creative thinking</u>

<u />

Learn lore about problem solving here:

brainly.com/question/24528689

3 0
2 years ago
Design a VHDL module
Aloiza [94]

Answer:

how we gonna do dat

Explanation:

5 0
2 years ago
Mrs. Pham has 8 apples. She wants to give 3/4 of the
Sergio039 [100]
The answer would be 32/3 or if you want the simplified version it’s 10 2/3.
6 0
2 years ago
Read 2 more answers
Why is the definition for second based on the Cesium 133 atom?
jarptica [38.1K]

Answer:

  The rate of vibrations of the atoms is consistent

Explanation:

A second is defined as 9,192,631,770 periods of the radiation corresponding to the transition between the two hyperfine levels of the ground state of the caesium 133 atom.

The definition applies when the atom is in isolation at a temperature of absolute zero. Adjustments must be made for the conditions that can be maintained in practice.

Such radiation is determined by the laws of quantum mechanics, so is extremely consistent.

7 0
3 years ago
Other questions:
  • Your task is to fill in the missing parts of the C code to get a program equivalent to the generated assembly code. Recall that
    5·1 answer
  • What is the difference Plastic vs elastic deformation.
    13·1 answer
  • If the value of the feedback resistor in the filter is changed but the value of the resistor in the forward path is unchanged, w
    14·1 answer
  • 1000 lb boulder B is resting on a 500 lb platform A when truck C accidentally accelerates to the right (truck in reverse). Which
    15·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
  • A car generator turns at 400 rpm (revolutions per minute) when the engine is idling. It has a rectangular coil with 300 turns of
    7·1 answer
  • Drag each label to the correct location on the image.
    5·2 answers
  • 7. Sockets internal designs come in what sizes?
    5·1 answer
  • For each function , sketch the Bode asymptotic magnitude and asymptotic phase plots.
    9·1 answer
  • For many clients, a decision is based primarily on time and money, which are the two most abundant
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!