Main
Vectors
Matrix
Matrix Manipulation
Transformation Matrices
Angles
Random
Bezier Curve
Equations
Path Movement
Color
Linear Interpolation
Derivatives
Collision Detection
Animation
Circle And Ellipse
Sequence
Combinatorics
Other

Arithmetic Sequence Sum

import { naturalNumbersSequenceSum } from 'mz-math';

// n = the number of terms to be added
const n = 4;

// a = the first term in the sequence
const a = 2;

// d = the constant value between terms
const d = 2;

// 2 + 4 + 6 + 8
const sum = naturalNumbersSequenceSum(n, a, d); // 20