Getting this error TypeError: Cannot convert a BigInt value to a number
:
function getCompositeNumbers() {
let v = []
let i = 1n
while (i < 1000000n) {
if (checkIfDivisible(i)) {
v.push(i)
}
i++
}
return v
}
function checkIfDivisible(i) {
if (i/2n == Math.floor(i/2n)) return true
if (i/3n == Math.floor(i/3n)) return true
if (i/5n == Math.floor(i/5n)) return true
if (i/7n == Math.floor(i/7n)) return true
if (i/11n == Math.floor(i/11n)) return true
if (i/13n == Math.floor(i/13n)) return true
return false
}