Solution for problem #12.
Triangle number sequence generator.