dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
986 B
986 B
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 6a22d77ddf034bc4e35b1d58 | Challenge 351: Pronic Number | 28 | challenge-351 |
--description--
Given a number, determine whether it is a pronic number.
A pronic number is the product of two consecutive integers. For example, 6 is pronic because 2 * 3 = 6.
--hints--
isPronic(6) should return true.
assert.isTrue(isPronic(6));
isPronic(15) should return false.
assert.isFalse(isPronic(15));
isPronic(12) should return true.
assert.isTrue(isPronic(12));
isPronic(132) should return true.
assert.isTrue(isPronic(132));
isPronic(80) should return false.
assert.isFalse(isPronic(80));
isPronic(0) should return true.
assert.isTrue(isPronic(0));
--seed--
--seed-contents--
function isPronic(n) {
return n;
}
--solutions--
function isPronic(n) {
const k = Math.floor(Math.sqrt(n));
return k * (k + 1) === n;
}