Welcome to the community!

Is implementing this in an **easy** way your question? But I think your implementation is not correct? It indicates `16`

as prime, which is not. See below:

```
prime <- function(x) {
a <- seq_len(x)
b <- length(a[(x %% a) == 0])
if (b > 2) {
c <- seq_len(x - 1)
d <- length(c[(x - 1) %% c == 0])
if (d > 2) {
"true"
}
}
}
prime(x = 16)
#> [1] "true"
```

^{Created on 2019-03-20 by the reprex package (v0.2.1)}

I've just no idea why have you done this. If there are only two factors, then they have to be unity and the number itself. So, you can conclude about prime or not prime only from `b`

.

Again, I can't follow why do you expect this will be the case. Your code doesn't check either for either case.

This question seems to be a assignment problem. Please familiarise yourself with the existing policy: