Problem 60306. Add non-triangular numbers
The nth triangular number is the sum of the first n positive integers. The sequence of triangular numbers starts 1, 3, 6, 10, 15, and 21. These numbers are involved in Cody Problems 5, 291, 44289, 44334, 44732, 55680, 55695, 55705, 55710, and 55715, for example.
Write a function to return the sum of the non-triangular numbers between the nth and (n+1)st triangular numbers. For example, if n = 3, then the function should return 7+8+9 = 24. Beware the banned functions.
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers13
Suggested Problems
-
2371 Solvers
-
Make a random, non-repeating vector.
11116 Solvers
-
Calculate the area of a triangle between three points
3404 Solvers
-
244 Solvers
-
Replace Nonzero Numbers with 1
442 Solvers
More from this Author319
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!