Login or Create an Account to view the mark scheme, comment, and add to a test
A recursive function tri(n) calculates and returns the sum of the first n natural numbers, also known as the nth triangular number. For example, tri(1), tri(2) and tri(3) return the numbers 1, 3 and 6 respectively. Visually, the tri(n) function could be imagined as one that calculates the number of dots contained within a nabla (a triangle with its tip facing downward) for a specified height n, as shown below.
[3]
Question Image
Construct the function tri(n)

Short Answer3 MarksPremium
2 Uses20 Views2 Likes