How to Check If Number is Prime in R (Example Code)
In this R article you’ll learn how to check for prime numbers.
Example: Apply isprime() Function of matlab Package to Check for Prime Numbers
install.packages("matlab") # Install & load matlab package library("matlab") |
install.packages("matlab") # Install & load matlab package library("matlab")
as.logical(isprime(5)) # Check whether number is prime number # [1] TRUE |
as.logical(isprime(5)) # Check whether number is prime number # [1] TRUE
as.logical(isprime(6)) # Check whether number is prime number # [1] FALSE |
as.logical(isprime(6)) # Check whether number is prime number # [1] FALSE