C (gcc), 119 71 69 bytes
p;main(a){for(scanf("%d",&p);++a<p;)p=p/a*a-p?p:1;puts(p-1?"1":"0");} - Thanks to ceilingcat for the reduction to 71 bytes.
Thanks to ceilingcat for the reduction to 71 bytes.
- Thanks to ceilingcat for another 2 bytes shaved off by using
putsinstead ofprintf.Thanks to ceilingcat for another 2 bytes shaved off by using
putsinstead ofprintf.
Outputs 0 (falsy) when it's composite and 1 (truthy) when it's prime.
My first C answer. To me, it's just a mix of Python and Assembly. Well, at least it's probably not as long as Java...