8 add language tag edit approved Sep 2 '14 at 20:59 tbodt 1,16222 gold badges1010 silver badges2020 bronze badges # ^ Prime Checker ([>:#,_@| Golf Inc. Ltd. | @_,#:<]) # ^ Ingo Bürk, (C) 2014 ################################################################################################ # Input should be a "reasonably" # small integer, or I can't guarantee # that the check is fast at all. # # More Details: - the numbers 0 and 1 are # handled as not prime, # even if some people disagree # # - because my employer prefers shortness # over well-tested, modular and # somewhat pretty code, the used method is # somewhat questionable # - first of all, the input is converted # into a string of 1s such that the # number of 1s equals the input; # directly after that, a regexp is applied # such that it checks if the input is prime # - the regexp is not really my work, so I # have to give attribution to its author # if I want to use it here; I got it on # stackoverflow: # "http://stackoverflow.com/questions/3296050/how-does-this-regex-find-primes" # <=> <--- a riddle^^ use v5.10; # Definition of prime number: ############################# # "A prime is a positive integer with exactly two unique divisors." # , # # I should mention that input is given via stdin. # # quality documentation like this is why I get paid so much. # use this script at your own risk. # it has been known that checking primes like this can crash interpreters. # this never happened to me, though. # . # "Less is more" -- Robert Browning (1812-1889) [Riddle Solution] print"not "if(1x shift)=~/^1?$|^(11+?)\1+$/;say"prime" # ^ Prime Checker ([>:#,_@| Golf Inc. Ltd. | @_,#:<]) # ^ Ingo Bürk, (C) 2014 ################################################################################################ # Input should be a "reasonably" # small integer, or I can't guarantee # that the check is fast at all. # # More Details: - the numbers 0 and 1 are # handled as not prime, # even if some people disagree # # - because my employer prefers shortness # over well-tested, modular and # somewhat pretty code, the used method is # somewhat questionable # - first of all, the input is converted # into a string of 1s such that the # number of 1s equals the input; # directly after that, a regexp is applied # such that it checks if the input is prime # - the regexp is not really my work, so I # have to give attribution to its author # if I want to use it here; I got it on # stackoverflow: # "http://stackoverflow.com/questions/3296050/how-does-this-regex-find-primes" # <=> <--- a riddle^^ use v5.10; # Definition of prime number: ############################# # "A prime is a positive integer with exactly two unique divisors." # , # # I should mention that input is given via stdin. # # quality documentation like this is why I get paid so much. # use this script at your own risk. # it has been known that checking primes like this can crash interpreters. # this never happened to me, though. # . # "Less is more" -- Robert Browning (1812-1889) [Riddle Solution] print"not "if(1x shift)=~/^1?$|^(11+?)\1+$/;say"prime"  # ^ Prime Checker ([>:#,_@| Golf Inc. Ltd. | @_,#:<]) # ^ Ingo Bürk, (C) 2014 ################################################################################################ # Input should be a "reasonably" # small integer, or I can't guarantee # that the check is fast at all. # # More Details: - the numbers 0 and 1 are # handled as not prime, # even if some people disagree # # - because my employer prefers shortness # over well-tested, modular and # somewhat pretty code, the used method is # somewhat questionable # - first of all, the input is converted # into a string of 1s such that the # number of 1s equals the input; # directly after that, a regexp is applied # such that it checks if the input is prime # - the regexp is not really my work, so I # have to give attribution to its author # if I want to use it here; I got it on # stackoverflow: # "http://stackoverflow.com/questions/3296050/how-does-this-regex-find-primes" # <=> <--- a riddle^^ use v5.10; # Definition of prime number: ############################# # "A prime is a positive integer with exactly two unique divisors." # , # # I should mention that input is given via stdin. # # quality documentation like this is why I get paid so much. # use this script at your own risk. # it has been known that checking primes like this can crash interpreters. # this never happened to me, though. # . # "Less is more" -- Robert Browning (1812-1889) [Riddle Solution] print"not "if(1x shift)=~/^1?$|^(11+?)\1+$/;say"prime"  # ^ Prime Checker ([>:#,_@| Golf Inc. Ltd. | @_,#:<]) # ^ Ingo Bürk, (C) 2014 ################################################################################################ # Input should be a "reasonably" # small integer, or I can't guarantee # that the check is fast at all. # # More Details: - the numbers 0 and 1 are # handled as not prime, # even if some people disagree # # - because my employer prefers shortness # over well-tested, modular and # somewhat pretty code, the used method is # somewhat questionable # - first of all, the input is converted # into a string of 1s such that the # number of 1s equals the input; # directly after that, a regexp is applied # such that it checks if the input is prime # - the regexp is not really my work, so I # have to give attribution to its author # if I want to use it here; I got it on # stackoverflow: # "http://stackoverflow.com/questions/3296050/how-does-this-regex-find-primes" # <=> <--- a riddle^^ use v5.10; # Definition of prime number: ############################# # "A prime is a positive integer with exactly two unique divisors." # , # # I should mention that input is given via stdin. # # quality documentation like this is why I get paid so much. # use this script at your own risk. # it has been known that checking primes like this can crash interpreters. # this never happened to me, though. # . # "Less is more" -- Robert Browning (1812-1889) [Riddle Solution] print"not "if(1x shift)=~/^1?$|^(11+?)\1+$/;say"prime"  7 deleted 271 characters in body edited Aug 30 '14 at 9:39 Ingo Bürk 2,56911 gold badge1111 silver badges2727 bronze badges I am using the word "the" in there, but it's not the "the" that gets printed. It might be technically invalid, I'll let the OP decide if the rules have to be this strict for the bonus challenge. If so, then so be it. The word "the" appeared in an earlier version of the code; although the OP said it was okay (because it wasn't that instance of "the" that got printed), I figured out how to comply with all the rules and also (subtly) remind folks about SE's licensing requirements. The rules state I cannot use certain words, but we read from left to right, so I assume having the words written out vertically is valid. I have no idea how I still got this job, seeing the terrible things I write in comments. I mean: riddles, really? I am using the word "the" in there, but it's not the "the" that gets printed. It might be technically invalid, I'll let the OP decide if the rules have to be this strict for the bonus challenge. If so, then so be it. The word "the" appeared in an earlier version of the code; although the OP said it was okay (because it wasn't that instance of "the" that got printed), I figured out how to comply with all the rules and also (subtly) remind folks about SE's licensing requirements. The rules state I cannot use certain words, but we read from left to right, so I assume having the words written out vertically is valid. I have no idea how I still got this job, seeing the terrible things I write in comments. I mean: riddles, really? I am using the word "the" in there, but it's not the "the" that gets printed. It might be technically invalid, I'll let the OP decide if the rules have to be this strict for the bonus challenge. If so, then so be it. The rules state I cannot use certain words, but we read from left to right, so I assume having the words written out vertically is valid. I have no idea how I still got this job, seeing the terrible things I write in comments. I mean: riddles, really? 6 Removed the word "the" from the code, to comply with the rules edited Aug 30 '14 at 0:34 Glenn Randers-Pehrson 1,87722 gold badges1010 silver badges2626 bronze badges # ^ Prime Checker ([>:#,_@| Golf Inc. Ltd. | @_,#:<]) # ^ Ingo Bürk, (C) 2014 ################################################################################################ # Input should be a "reasonably" # small integer, or I can't guarantee # that the check is fast at all. # # More Details: - the numbers 0 and 1 are # handled as not prime, # even if some people disagree # # - because my employer prefers shortness # over well-tested, modular and # somewhat pretty code, the used method is # somewhat questionable # - first of all, the input is converted # into a string of 1s such that the # number of 1s equals the input; # directly after that, a regexp is applied # such that it checks if the input is prime # - the regexp is not really my work, so I # have to give attribution to it'sits author # if I want to use it here; I got it on # stackoverflow: # "http://stackoverflow.com/questions/3296050/how-does-this-regex-find-primes" # <=> <--- a riddle^^ use v5.10; # Definition of prime number: ############################# # "A prime is a positive integer with exactly two unique divisors." # , # # I should mention that input is given via stdin. # # quality documentation like this is why I get paid so much. # use this script at your own risk. # it has been known that checking primes like this can crash interpreters. # this never happened to me, though. # . # "Less is more" -- Robert Browning (1812-1889) [Riddle Solution] print"not "if(1x shift)=~/^1?$|^(11+?)\1+$/;say"prime"  # ^ Prime Checker ([>:#,_@| Golf Inc. Ltd. | @_,#:<]) # ^ Ingo Bürk, (C) 2014 ################################################################################################ # Input should be a "reasonably" # small integer, or I can't guarantee # that the check is fast at all. # # More Details: - the numbers 0 and 1 are # handled as not prime, # even if some people disagree # # - because my employer prefers shortness # over well-tested, modular and # somewhat pretty code, the used method is # somewhat questionable # - first of all, the input is converted # into a string of 1s such that the # number of 1s equals the input; # directly after that, a regexp is applied # such that it checks if the input is prime # - the regexp is not really my work, so I # have to give attribution to it's author # if I want to use it here; I got it on # stackoverflow: # "http://stackoverflow.com/questions/3296050/how-does-this-regex-find-primes" # <=> <--- a riddle^^ use v5.10; # Definition of prime number: ############################# # "A prime is a positive integer with exactly two unique divisors." # , # # I should mention that input is given via stdin. # # quality documentation like this is why I get paid so much. # use this script at your own risk. # it has been known that checking primes like this can crash interpreters. # this never happened to me, though. # . # "Less is more" -- Robert Browning (1812-1889) [Riddle Solution] print"not "if(1x shift)=~/^1?$|^(11+?)\1+$/;say"prime"  # ^ Prime Checker ([>:#,_@| Golf Inc. Ltd. | @_,#:<]) # ^ Ingo Bürk, (C) 2014 ################################################################################################ # Input should be a "reasonably" # small integer, or I can't guarantee # that the check is fast at all. # # More Details: - the numbers 0 and 1 are # handled as not prime, # even if some people disagree # # - because my employer prefers shortness # over well-tested, modular and # somewhat pretty code, the used method is # somewhat questionable # - first of all, the input is converted # into a string of 1s such that the # number of 1s equals the input; # directly after that, a regexp is applied # such that it checks if the input is prime # - the regexp is not really my work, so I # have to give attribution to its author # if I want to use it here; I got it on # stackoverflow: # "http://stackoverflow.com/questions/3296050/how-does-this-regex-find-primes" # <=> <--- a riddle^^ use v5.10; # Definition of prime number: ############################# # "A prime is a positive integer with exactly two unique divisors." # , # # I should mention that input is given via stdin. # # quality documentation like this is why I get paid so much. # use this script at your own risk. # it has been known that checking primes like this can crash interpreters. # this never happened to me, though. # . # "Less is more" -- Robert Browning (1812-1889) [Riddle Solution] print"not "if(1x shift)=~/^1?$|^(11+?)\1+$/;say"prime"  5 Removed the word "the" from the code, to comply with the rules edit approved Aug 30 '14 at 0:34 user46322 311 bronze badge 4 added 7 characters in body edited Aug 28 '14 at 19:33 Ingo Bürk 2,56911 gold badge1111 silver badges2727 bronze badges 3 added 40 characters in body edited Aug 28 '14 at 19:26 Ingo Bürk 2,56911 gold badge1111 silver badges2727 bronze badges 2 added 31 characters in body edited Aug 28 '14 at 19:13 Ingo Bürk 2,56911 gold badge1111 silver badges2727 bronze badges Post Undeleted by Ingo Bürk occurred Aug 28 '14 at 19:09 Post Deleted by Ingo Bürk occurred Aug 28 '14 at 19:09 1 answered Aug 28 '14 at 19:08 Ingo Bürk 2,56911 gold badge1111 silver badges2727 bronze badges