This question already has an answer here:
- Is it a prime? w/o math [closed] 8 answers
Write a program which determines if a given number is prime.
The catch: No digits or arithmetical operators. This means:
- No digits from
9, anywhere in the program, and whatever the meaning
- No using any built-in operators for addition (and incrementing), subtraction (and decrementing), multiplication, division, exponentiation, or modulus, anywhere in the program
- This includes symbols like
+and functions like
- All other operations are permitted
- You may define your own functions for the forbidden operations
- You may use symbols like
-when they mean things other than the forbidden operations
Shortest code wins - any language permitted.
An ungolfed solution in Java can be found here.