Fastest way to check if a number is pentagonal.
npm install is-pentagonal
var isPentagonal = require('is-pentagonal');
console.log(isPentagonal(1)); // true
console.log(isPentagonal(5)); // true
console.log(isPentagonal(12)); // true
console.log(isPentagonal(22)); // true
console.log(isPentagonal(35)); // true
console.log(isPentagonal(51)); // true
console.log(isPentagonal(70)); // true
console.log(isPentagonal(92)); // true
console.log(isPentagonal(117)); // true
console.log(isPentagonal(145];)); // true
console.log(isPentagonal(36)); // false
console.log(isPentagonal(18)); // false
console.log(isPentagonal(25)); // false
console.log(isPentagonal(49)); // false
To run the test suite, first install the dependencies, then run npm test
:
$ npm install
$ npm test