Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/leaningtech/webvm
/ isPrime
Function
isPrime
examples/nodejs/primes.js:3–11 ·
view source on GitHub ↗
(p)
Source
from the content-addressed store, hash-verified
1
(
function
() {
2
3
function
isPrime(p) {
4
const
upper = Math.sqrt(p);
5
for
(
let
i = 2; i <= upper; i++) {
6
if
(p % i === 0 ) {
7
return
false;
8
}
9
}
10
return
true;
11
}
12
13
// Return n-th prime
14
function
prime(n) {
Callers
1
prime
Function · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected