K (oK), 1414 19 bytes
Solution:
2=+/d=_d:x%!x:. 0:` Example:
root@c957fa0dccbd:/ok# echo 1 | node repl.js examples/prime.k 0 root@c957fa0dccbd:/ok# echo 2 | node repl.js examples/prime.k 1 root@c957fa0dccbd:/ok# echo 5 | node repl.js examples/prime.k 1 root@c957fa0dccbd:/ok# echo 97 | node repl.js examples/prime.k 1 Explanation:
Calculate number of factors for input, if equal to 2, then it's prime.
2=+/d=_d:x%!x:. 0:` / the solution 0:` / read from stdin . / value (ie convert "123" > 123) x: / store input as x ! / range 0..x x% / x divided by ... d: / store as d _ / floor d= / d equal to ... +/ / sum 2= / 2 equals?