polygonal

1.0.2 • Public • Published

polygonal

NodeJs module for getting polygonal numbers

The Polygonal Numbers

Polygonal numbers are numbers that can be arranged in a regular polygon if they're represented as dots.

eg.:

triangular numbers

Triangular numbers

Formula

The formula to get the nth polygonal number of a s-sided polygon is:

polygonal formula

Installation

This module is on the npm repository, to intall it run the following command

$ npm install polygonal

Usage

var polygonal = require('polygonal');
 
// get the second pentagonal
var x = polygonal.getSGonal(5, 2);
var y = polygonal.getPentagonal(2);
 
// x is equal to y!!

References

http://en.wikipedia.org/wiki/Polygonal_number

Dependents (0)

Package Sidebar

Install

npm i polygonal

Weekly Downloads

1

Version

1.0.2

License

MIT

Last publish

Collaborators

  • viniciusvgv