Question: Erlang Language Questions: 1. Write an Erlang function named product that takes one parameter, a list of numbers. The function should return the product (multiplication)

Erlang Language Questions:

1. Write an Erlang function named product that takes one parameter, a list of numbers. The function should return the product (multiplication) of all the items in the list. For example, calling the function product( [1, 2, 3, 4, 5, 6] ) should return 720. If the list is empty, the function should return 1.

2. Mathematicians have discovered a new series of numbers; they have named them the Thede numbers, after their discoverer. The first Thede number is 1 and the second Thede number is 2. Further numbers in the sequence are equal to one less than the sum of the two previous numbers. So, for example, the third Thede number is 2, since 1 + 2 1 = 2. The fourth Thede number is 3, since 2 + 2 - 1 = 3. The series is 1, 2, 2, 3, 4, 6, 9, 14, 22, 35, Write an Erlang function named thede that has one parameter, an integer. If the integer parameter is N, the function should return the value of the Nth Thede number. For example, thede( 7 ) should return 9.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!