##JavaScript (ES6), (削除) 30 (削除ここまで)(削除) 29 (削除ここまで) 28 bytes
JavaScript (ES6), (削除) 30 (削除ここまで)(削除) 29 (削除ここまで) 28 bytes
Expects a positive integer. Returns -1 for falsy and -2 for truthy.
f=(n,k=2)=>n>1?f(n/k,k+1):~n
console.log(1, '-->',f(1)) // Truthy (0! or 1!)
console.log(2, '-->',f(2)) // Truthy (2!)
console.log(3, '-->',f(3)) // Falsey
console.log(4, '-->',f(4)) // Falsey
console.log(5, '-->',f(5)) // Falsey
console.log(6, '-->',f(6)) // Truthy (3!)
console.log(7, '-->',f(7)) // Falsey
console.log(8, '-->',f(8)) // Falsey
console.log(24, '-->',f(24)) // Truthy (4!)
console.log(120,'-->',f(120)) // Truthy (5!)
Note: This function supports pretty large inputs (you should read this as: 'pretty large for JS'). It should work safely up to 253 - 1. It will fail for sure starting at N = 121,645,100,408,831,992, this input being rounded to 19! = 121,645,100,408,832,000 because of its IEEE-754 encoding. There may be other false positive results before 121,645,100,408,831,991 because of rounding errors, but I don't know for sure.
##JavaScript (ES6), (削除) 30 (削除ここまで)(削除) 29 (削除ここまで) 28 bytes
Expects a positive integer. Returns -1 for falsy and -2 for truthy.
f=(n,k=2)=>n>1?f(n/k,k+1):~n
console.log(1, '-->',f(1)) // Truthy (0! or 1!)
console.log(2, '-->',f(2)) // Truthy (2!)
console.log(3, '-->',f(3)) // Falsey
console.log(4, '-->',f(4)) // Falsey
console.log(5, '-->',f(5)) // Falsey
console.log(6, '-->',f(6)) // Truthy (3!)
console.log(7, '-->',f(7)) // Falsey
console.log(8, '-->',f(8)) // Falsey
console.log(24, '-->',f(24)) // Truthy (4!)
console.log(120,'-->',f(120)) // Truthy (5!)
Note: This function supports pretty large inputs (you should read this as: 'pretty large for JS'). It should work safely up to 253 - 1. It will fail for sure starting at N = 121,645,100,408,831,992, this input being rounded to 19! = 121,645,100,408,832,000 because of its IEEE-754 encoding. There may be other false positive results before 121,645,100,408,831,991 because of rounding errors, but I don't know for sure.
JavaScript (ES6), (削除) 30 (削除ここまで)(削除) 29 (削除ここまで) 28 bytes
Expects a positive integer. Returns -1 for falsy and -2 for truthy.
f=(n,k=2)=>n>1?f(n/k,k+1):~n
console.log(1, '-->',f(1)) // Truthy (0! or 1!)
console.log(2, '-->',f(2)) // Truthy (2!)
console.log(3, '-->',f(3)) // Falsey
console.log(4, '-->',f(4)) // Falsey
console.log(5, '-->',f(5)) // Falsey
console.log(6, '-->',f(6)) // Truthy (3!)
console.log(7, '-->',f(7)) // Falsey
console.log(8, '-->',f(8)) // Falsey
console.log(24, '-->',f(24)) // Truthy (4!)
console.log(120,'-->',f(120)) // Truthy (5!)
Note: This function supports pretty large inputs (you should read this as: 'pretty large for JS'). It should work safely up to 253 - 1. It will fail for sure starting at N = 121,645,100,408,831,992, this input being rounded to 19! = 121,645,100,408,832,000 because of its IEEE-754 encoding. There may be other false positive results before 121,645,100,408,831,991 because of rounding errors, but I don't know for sure.
##JavaScript (ES6), (削除) 30 (削除ここまで) (削除) 29 (削除ここまで) 28 bytes
Expects a positive integer. Returns -1 for falsy and -2 for truthy.
f=(n,k=2)=>n>1?f(n/k,k+1):~n
console.log(1, '-->',f(1)) // Truthy (0! or 1!)
console.log(2, '-->',f(2)) // Truthy (2!)
console.log(3, '-->',f(3)) // Falsey
console.log(4, '-->',f(4)) // Falsey
console.log(5, '-->',f(5)) // Falsey
console.log(6, '-->',f(6)) // Truthy (3!)
console.log(7, '-->',f(7)) // Falsey
console.log(8, '-->',f(8)) // Falsey
console.log(24, '-->',f(24)) // Truthy (4!)
console.log(120,'-->',f(120)) // Truthy (5!)
Note: This function supports pretty large inputs (you should read this as: 'pretty large for JS'). It should work safely up to 253 - 1. It will fail for sure starting at N = 121,645,100,408,831,992, this input being rounded to 19! = 121,645,100,408,832,000 because of its IEEE-754 encoding. ItThere may fail somewhere between 253 andbe other false positive results before 121,645,100,408,831,991 because of another rounding errorerrors, but I don't know for sure.
##JavaScript (ES6), (削除) 30 (削除ここまで) (削除) 29 (削除ここまで) 28 bytes
Expects a positive integer. Returns -1 for falsy and -2 for truthy.
f=(n,k=2)=>n>1?f(n/k,k+1):~n
console.log(1, '-->',f(1)) // Truthy (0! or 1!)
console.log(2, '-->',f(2)) // Truthy (2!)
console.log(3, '-->',f(3)) // Falsey
console.log(4, '-->',f(4)) // Falsey
console.log(5, '-->',f(5)) // Falsey
console.log(6, '-->',f(6)) // Truthy (3!)
console.log(7, '-->',f(7)) // Falsey
console.log(8, '-->',f(8)) // Falsey
console.log(24, '-->',f(24)) // Truthy (4!)
console.log(120,'-->',f(120)) // Truthy (5!)
Note: This function supports pretty large inputs (you should read this as: 'pretty large for JS'). It should work safely up to 253 - 1. It will fail for sure starting at N = 121,645,100,408,831,992, this input being rounded to 19! = 121,645,100,408,832,000 because of its IEEE-754 encoding. It may fail somewhere between 253 and 121,645,100,408,831,991 because of another rounding error, but I don't know for sure.
##JavaScript (ES6), (削除) 30 (削除ここまで) (削除) 29 (削除ここまで) 28 bytes
Expects a positive integer. Returns -1 for falsy and -2 for truthy.
f=(n,k=2)=>n>1?f(n/k,k+1):~n
console.log(1, '-->',f(1)) // Truthy (0! or 1!)
console.log(2, '-->',f(2)) // Truthy (2!)
console.log(3, '-->',f(3)) // Falsey
console.log(4, '-->',f(4)) // Falsey
console.log(5, '-->',f(5)) // Falsey
console.log(6, '-->',f(6)) // Truthy (3!)
console.log(7, '-->',f(7)) // Falsey
console.log(8, '-->',f(8)) // Falsey
console.log(24, '-->',f(24)) // Truthy (4!)
console.log(120,'-->',f(120)) // Truthy (5!)
Note: This function supports pretty large inputs (you should read this as: 'pretty large for JS'). It should work safely up to 253 - 1. It will fail for sure starting at N = 121,645,100,408,831,992, this input being rounded to 19! = 121,645,100,408,832,000 because of its IEEE-754 encoding. There may be other false positive results before 121,645,100,408,831,991 because of rounding errors, but I don't know for sure.
##JavaScript (ES6), (削除) 30 (削除ここまで) (削除) 29 (削除ここまで) 28 bytes
Expects a positive integer. Returns -1 for falsy and -2 for truthy.
f=(n,k=2)=>n>1?f(n/k,k+1):~n
console.log(1, '-->',f(1)) // Truthy (0! or 1!)
console.log(2, '-->',f(2)) // Truthy (2!)
console.log(3, '-->',f(3)) // Falsey
console.log(4, '-->',f(4)) // Falsey
console.log(5, '-->',f(5)) // Falsey
console.log(6, '-->',f(6)) // Truthy (3!)
console.log(7, '-->',f(7)) // Falsey
console.log(8, '-->',f(8)) // Falsey
console.log(24, '-->',f(24)) // Truthy (4!)
console.log(120,'-->',f(120)) // Truthy (5!)
Note: This function supports pretty large inputs (you should read this as: 'pretty large for JS'). It should work safely up to 253 - 1. It will fail for sure starting at N = 121,645,100,408,831,992, this input being rounded to 19! = 121,645,100,408,832,000 because of its IEEE-754 encoding. It may fail somewhere between 253 and 121,645,100,408,831,991 because of another rounding error, but I don't know for sure.
##JavaScript (ES6), (削除) 30 (削除ここまで) (削除) 29 (削除ここまで) 28 bytes
Expects a positive integer. Returns -1 for falsy and -2 for truthy.
f=(n,k=2)=>n>1?f(n/k,k+1):~n
console.log(1, '-->',f(1)) // Truthy (0! or 1!)
console.log(2, '-->',f(2)) // Truthy (2!)
console.log(3, '-->',f(3)) // Falsey
console.log(4, '-->',f(4)) // Falsey
console.log(5, '-->',f(5)) // Falsey
console.log(6, '-->',f(6)) // Truthy (3!)
console.log(7, '-->',f(7)) // Falsey
console.log(8, '-->',f(8)) // Falsey
console.log(24, '-->',f(24)) // Truthy (4!)
console.log(120,'-->',f(120)) // Truthy (5!)
##JavaScript (ES6), (削除) 30 (削除ここまで) (削除) 29 (削除ここまで) 28 bytes
Expects a positive integer. Returns -1 for falsy and -2 for truthy.
f=(n,k=2)=>n>1?f(n/k,k+1):~n
console.log(1, '-->',f(1)) // Truthy (0! or 1!)
console.log(2, '-->',f(2)) // Truthy (2!)
console.log(3, '-->',f(3)) // Falsey
console.log(4, '-->',f(4)) // Falsey
console.log(5, '-->',f(5)) // Falsey
console.log(6, '-->',f(6)) // Truthy (3!)
console.log(7, '-->',f(7)) // Falsey
console.log(8, '-->',f(8)) // Falsey
console.log(24, '-->',f(24)) // Truthy (4!)
console.log(120,'-->',f(120)) // Truthy (5!)
Note: This function supports pretty large inputs (you should read this as: 'pretty large for JS'). It should work safely up to 253 - 1. It will fail for sure starting at N = 121,645,100,408,831,992, this input being rounded to 19! = 121,645,100,408,832,000 because of its IEEE-754 encoding. It may fail somewhere between 253 and 121,645,100,408,831,991 because of another rounding error, but I don't know for sure.