3
Given a number determine if it is a circular prime.
A circular prime is a prime where if you rotate the digits you still get prime numbers. 1193 is circular prime because 1931 and 9311 and 3119 are all primes.
Input: Output:
1193 circular
11939 circular
1456 nothing
193939 circular
1111111 nothing
7 circular
23 nothing
Shortest code wins.
1I don't think this should have the code-challenge tag. – Cruncher – 2013-11-12T19:18:38.223
@Cruncher Wouldn't solving such problem in shortest possible code require creative thinking? If it is not code-challenge then I will gladly remove it, just assumed it to be challenge. – Quillion – 2013-11-12T19:34:47.560
1
Not a big deal, but they're sort of disjoint. http://codegolf.stackexchange.com/tags/code-challenge/info "A code challenge is a competition for creative ways to solve a programming puzzle for an objective criterion other than code size."
– Cruncher – 2013-11-12T19:36:59.323@Cruncher sorry about that. Thanks for clarifying it for me :) – Quillion – 2013-11-12T19:42:20.000
4-1 You stated: "Shortest code wins" but awarded the check to a submission that was 4 times as long as the shortest submitted! – DavidC – 2013-11-14T19:50:02.533
@DavidCarraher I asked for specific output. I do not see the shortest answer provide such output. Try running some programs and see if input and output matches for what is requested. – Quillion – 2013-11-14T20:37:31.617
You must be kidding. – DavidC – 2013-11-14T20:56:30.090
@DavidCarraher please do enlighten me which is the answer whose's code if I copy paste and run will yield the output on the given input specified above? – Quillion – 2013-11-14T21:44:34.203
1My own code returns True if a number is circular, False if a number is not circular. I find that a reasonable alternative to "circular" and "nothing". The shorter solution in J appears to follow the same Boolean convention (True, False). – DavidC – 2013-11-14T22:05:55.750
4@DavidCarraher Some problems on this site require specific output. This is one. Deal with it and stop whining. "Oh, poor me, my output
99,98,97...
is equivalent to the lyrics of '99 bottles of beer on the wall' but it wasn't an accepted answer!" – boothby – 2013-11-14T22:13:41.6401@Boothby. Bad example. "99 bottles of beer on the wall" is all about crafting a specific output, the lyrics of a song. The present example is advertised a test of circularity of a number: "Given a number determine if it is a circular prime." Example output was given. But it was not stated (nor should it have been, in my view) that that specific format is required). – DavidC – 2013-11-14T22:21:10.260
1@DavidCarraher, It most certainly is stated. despite your wishes to the contrary. Look at the question, and see "Input" and "Output". This is a 'compound question': solve a challenge and format the output. – boothby – 2013-11-15T02:42:56.227