Discrete Math def proceduren if n

Discrete Math

def procedure(n):
if n <= 0:
return 1
return procedure(n-1) + procedure(n-2) + procedure(n-3)

If n is 7 what is the resulting value?

Solution

Let us refer to procedure as p.

p(0) = 1
p(1) = 3
p(2) = 3 + 1 + 1 = 5
p(3) = 5 + 3 + 1 = 9
p(4) = 17
p(5) = 31
p(6) = 57
p(7) = 105

Discrete Math def procedure(n): if n <= 0: return 1 return procedure(n-1) + procedure(n-2) + procedure(n-3) If n is 7 what is the resulting value?SolutionLet

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site