Yes, you can choose the output.
In fact, this is already what we do.
A full program that prints to STDOUT will also terminate with a certain exit code, and exit codes are a valid form of output.
Per consensus, programs are allowed to terminate with an error after producing the correct output, so we're ignoring the exit code here.
We also allow C programs which do not include
return 0 at the end. This is undefined behavior in C89, so the exit code could literally be anything.
We allow a function to print the output to STDOUT, since it may output via the same methods as full programs.
In many languages, the function will also have a return value. We ignore the return value of the function in this case.
At this moment, the proposal of printing output to STDERR has a positive score, yet STDERR is ignored by default.
Functions may output by modifying their arguments, but if we print or return the desired result, we do not have to leave the arguments in a specific state.
Trying to specify which kinds of output can be ignored and which cannot seems artificial and will probably be ambiguous.
I therefore propose that we can liberally choose a single output format and ignore any results or side effects that could alternatively be chosen as output, with the following restriction.
The output format should be consistent for all possible inputs and every time the program/function is executed. The function
correctly prints True for primes and correctly returns False for non-primes, but it obviously should not be considered a valid submission to a challenge.