Important
Completely removed findN
in favour of findNthTerm
Quadratic Patterns
findNthTerm
num1
: The first number in the sequencenum2
: The second number in the sequencenum3
: The third number in the sequence
findTerm
Find a term in the sequence
n
: The term numbera
: Quadratic coefficient (a
n² + bn + c)b
: Linear coefficient (an² +b
n + c)c
: Constant term / y-intercept (an² + bn +c
)
const { QuadraticPattern } = require("@yetnt/ump");
let nthTerm = QuadraticPattern.findNthTerm(139, 184, 235);
console.log(nthTerm); // { a: 3, b: 36, c: 100, formula: '(3n^2) + (36n) + 100' }
QuadraticPattern.findTerm(20, nthTerm.a, nthTerm.b, nthTerm.c); // 2020
findTerms
Returns an array of the pattern starting at term n
and ending at term nn
n
: The term to start atnn
: The term to end ata
: Quadratic coefficient (a
n² + bn + c)b
: Linear coefficient (an² +b
n + c)c
: Constant term / y-intercept (an² + bn +c
)
const { QuadraticPattern } = require("@yetnt/ump");
const a = QuadraticPattern.findTerms(1, 10, 1, 2, 7);
console.log(a); // [10, 15, 22, 31, 42, 55, 70, 87, 106, 127]
Full Changelog: v5.2.0...v6.0.0