1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/// Generate triangular numbers: 1, 3, 6, 10, 15, 21...
///
/// The nth triangular number is the sum of the first n positive integers: T(n) = n*(n+1)/2
/// Creates natural ascending melodic contours.
///
/// # Examples
/// ```
/// use tunes::sequences;
/// let tri = sequences::triangular::generate(6);
/// assert_eq!(tri, vec![1, 3, 6, 10, 15, 21]);
/// ```
// ========== PRESETS ==========
/// Short triangular sequence - [1, 3, 6, 10, 15, 21]
/// Classic triangular sequence - [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78]
/// Extended triangular sequence - 16 terms