-5
1
This challenge is quite simple to conceptualise, but likely a lot harder to execute.
In this challenge, the program will have to detect the number N of its characters that have been randomly changed (at least half of the program will always remain). Then, it will have to output the Nth prime number.
A 'change' can only be the replacement of a character. You can assume it will always be replaced by something within your own language's alphabet.
Rules
- Only half of your program (rounded down to fewer changes, if necessary) will ever be hit by radiation.
- Standard output formats apply.
- The prime number must always be correct. Regarding the 'Nth' prime, N can be 1- or 0-indexed.
- 1 is not a prime number!
- If nothing (or only 1 character, if you choose to make N 1-indexed) is changed, output 0/null/any falsey value.
- This is code-golf, so shortest answer in bytes wins.
- Standard loopholes apply.
1What kind of changes may happen? Is it possible that the very first character is changed into something outside of language alphabet, making code unacceptable by compiler/interpreter? – Daniil Tutubalin – 2019-07-06T11:30:29.430
@DaniilTutubalin see now. – Geza Kerecsenyi – 2019-07-06T11:42:26.590
5
All of your recent challenges have been either put on hold or been very poorly recieved. I strongly suggest using the Sandbox in the future to check community feedback and clear up obvious unintended loopholes before posting to main
– Jo King – 2019-07-06T12:25:08.0635I would suggest to change it this way: one (and exactly one) random character is changed. The program must find its index N and output Nth prime number. Or just output N (if its not a duplicate). – Daniil Tutubalin – 2019-07-06T12:45:20.090
What counts as the language's alphabet? – Post Rock Garf Hunter – 2019-07-06T14:57:41.200
Anything it can parse @SriotchilismOZaic – Geza Kerecsenyi – 2019-07-06T17:31:58.133
1Closing as unclear because as the rules currently are, I could make a 1-character program that outputs 0 or null, and solutions longer than 3 characters seem impossible, which is probably not what the author intends. – lirtosiast – 2019-07-06T23:18:16.333