The challenge is fairly simple:
- Take a string of numerals
- Find and print the largest contiguous prime number in the string
- Lowest number of characters wins.
- Victor will likely be a golfscript entry but we won't hold that against them, cause we all have fun and learn things, right.
- Winner we be awarded when I notice that I haven't actually ticked the green button.
- The string is only numbers
- If the string contains letters, you may have undefined behaviour
- The string contains at least 1 prime
- If the string does not contains 1 valid prime number, you may have undefined behaviour
- Speed is not a constraint
- Use a shorter prime algorithm over a faster one.
- If your entry eventually finishes, thats ok, just make sure it will provable happen before the heat death of the universe.
- The length of the string can be assumed less than 15 characters long
>> Input: 3571 << Output: 3571 >> Input: 123 << Output: 23 >> Input: 1236503 << Output: 236503 >> Input: 46462 << Output: 2 >> Input: 4684 << Output: ValueError: max() arg is an empty sequence >> Input: 460 << Output: 0 # Note, zero is not a prime, but the above string has no valid prime >> Input: 4601 << Output: 601 >> Input: "12 monkeys is a pretty good movie, but not as good as se7en" << Output: ValueError: Fight Club was also good, I find Brad Pitt to be a consistantly good actor.