October 2014
Intermediate to advanced
280 pages
7h 20m
English
Implement and run a function sum(n) that uses recursion to calculate the sum of the integers from 1 to n. You’ll need to write this function inside a module in a separate file. Then load up iex, compile that file, and try your function.
Write a function gcd(x,y) that finds the greatest common divisor between two nonnegative integers. Algebraically, gcd(x,y) is x if y is zero; it’s gcd(y, rem(x,y)) otherwise.
Read now
Unlock full access