Skip to content

v6.0.0

Latest
Compare
Choose a tag to compare
@YetNT YetNT released this 09 Mar 10:43
· 10 commits to main since this release

Important

Completely removed findN in favour of findNthTerm

Quadratic Patterns

findNthTerm

  • num1: The first number in the sequence
  • num2: The second number in the sequence
  • num3: The third number in the sequence

findTerm

Find a term in the sequence

  • n: The term number
  • a: Quadratic coefficient (an² + bn + c)
  • b: Linear coefficient (an² + bn + 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 at
  • nn: The term to end at
  • a: Quadratic coefficient (an² + bn + c)
  • b: Linear coefficient (an² + bn + 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