The nth triangular number is given by n * (n + 1) / 2
. Create a sequence of the first 20 triangular numbers and call it triang
. R has a built-in constant, letters
, that contains the lowercase letters of the Roman alphabet. Name the elements of the vector that you just created with the first 20 letters of the alphabet. Select the triangular numbers where the name is a vowel (no need to store this into a new object).
(from: Cotton, 2013, Learning R, O’Reilly)