text:
Programming Dichotomies (Literally)
Consider a question written in plain English whose answer involves two reasonably accurate (but potentially clever) words or phrases that can be separated by the word 'and':

Q: What are the two sides of a coin? A: heads and tails
Q: What are the best ways to travel? A: airplane and jetpack
Q: Why is a raven like a writing desk? A: because there is a 'b' in both and an 'n' in neither

Goal
Write a program which, when run normally, outputs such a question.
When every other character is removed from the program starting with the second character and the result is re-run, the output should be whatever is to the left of the 'and' in the answer.
When every other character is removed from the program starting with the first character and the result is re-run, the output should be whatever is to the right of the 'and' in the answer.
(The 'and' itself is not output.)
Example
If the program is
A1B2C3D4E5F6G7H8I9

and its output is
What are the two sides of a coin?

Then the output of ABCDEFGHIshould be heads, and the output of 123456789 should be tails.
Rules about questions and answers

You may use my example questions but I encourage you to make up your own.
The question and the two answer parts:

must all be distinct
should be common grammatical meaningful English
may only contain printable ASCII (hex 20 to 7E)

Ideally the question will be capitalized and punctuated (but the answers do not need to be).
The question must be at least 30 character long and have entropy above or equal to 3.5. (Type in string, hit calculate, look for last H(X).)
The two answer parts (not including the [space]and[space] between them) must each have at least 5 characters with entropy above or equal to 2.
The word 'and' may appear in either answer part.

Rules about code

None of the 3 code snippets may:

contain comments or anything else traditionally ignored by the compiler/interpreter (don't worry about putting an extra semicolon or two in, but if you think it's a comment it probably is)
exit the program in mid-execution

The code may contain any characters, including Unicode and non-printable ASCII.
It may have an odd or even number of characters.
Output goes to stdout or a file or whatever seems reasonable. There is no input.

Scoring
Since I wan't to encourage golfed answers but I want to encourage clever answers even more, the scoring will be something in between code-golf and popularity contest:
Score = (upvotes - downvotes) - floor((bytes in code that outputs question) / 3)
The highest score wins.
(Use http://mothereff.in/byte-counter as a byte counter.)

Gah, this is so hard to do in a "normal" language like JavaScript. The farthest I can get is something like x0=00;;. Great challenge!

@Doorknob sorry to deflate your boat, but 00; is traditionally ignored by the compiler...

Seriously... "apple" has a Shannon entropy of 1.92???

@JanDvorak 00; is fine. I mainly just meant to restrict comments.

It may have an odd or even number of characters Is there a number of characters that is not odd or even?

@Snack That lets people know that the two answer code parts don't need to have the same length.

Can I write to a file as output?

@Ourous Sure. I might as well remove the "output to stdout" restriction since it might loosen up the problem.

Interesting problem...though I was enjoying it a bit more before I wound up going in the "eval" direction.  Perhaps there could be a similar problem of three different outputs, that's a bit more challenging in terms of what's different about the programs, and disallowed eval of code as strings?

I was just reading the question, and I think that your third example answer may be reversed.

@Magus How so exactly?

Nevermind, got the joke. Must've been blind yesterday.

This is insane! It's hard to believe it's even possible, yet look at all the answers!

Hate to nitpick, but it's a tall order to put specific requirements on the entropy contents. Firstly, one can't talk about entropy of a message without a context involving an a priori probability distribution over the messages (and not just the observed probability of individual chars in one msg). The closest objective measurement of complexity (which is of course related to entropy) is  Kolmogorov complexity, but it can not be calculated by any program, including the calculator you link to.

@Morty I know the entropy restraint isn't perfect but it seems the easiest way to ensure people don't give potentially trivial repetitive answers.

@Calvin: My sympathies for that. But the wording of the question gives the impression that the requirement is for the actual entropy in the string, not the entropy using some specific calculator. Besides, the whole way this calculator works is based on a huge misunderstanding of what entropy is, IMHO.

Are there any practical uses for something like this? No disrespect intended; just curious.

Javascript (148 bytes)
Creates some nonsense literals, with the side effect of creating an alert* for the question. (the splits doing similar, but creating alerts* for each of the answers).

"';"+alert( 'What is the ideal breakfast???')+/ " ;apl=e"rbta(k"esnc"r.armebplleadc ee g g s(" ) + " \/)k;e"/+ ",t'hceo 'c)a;kye= ailse rat (lpi)e "

Splits:
";+lr('hti h da rafs??)/";p="baken".replace   (    /ke/ ,'co');y=alert(p)

and
'"aet Wa steielbekat?'+  alert("scrambled eggs")+"\);"+"the cake is a lie"

Question: What is the ideal breakfast???
Answers: bacon and scrambled eggs

This is the kind of quality that I love about this site! Where else can you find people that can do this??

I've taken improv classes (perhaps obviously) and I'll give you a +1 here for the humor value.  But as all aperture science engineers know, we are practitioners of science...so really, the funniest part is to make a neat gun.  :-)

Brainfuck (437 characters)
I have to confess that this is my first brainfuck program that actually does something meaningful. The program is highly optimized for low memory systems since it uses only 4 memory locations.
Question: What are the two main groups of trees?
Answers: conifers and broadleafs
-+[[++++++++++++++++++++++[+>++++++[+>++++++++++++<>-+]+>+-+.++++++<+<+-+]+>+++++.+>++.+-..------.-<--..-+-+-+..->.-+-+-+.+<+++.+-+-+-+-+.++++.+++.+<.+>-+++-+++-+++-++.->]]++-+[[+-+-[[+++++++++++++++[>++>+++++>+++++++<<<-]>-->>---<++.+++++++++++++++++.-------.>.<<.>.>--.<++++.<.>>++.<+++.---.<.>>.+++.<++++++++++.<.>--.------------.++++++++.+++++.<.>-------.>-----.<++++++++.>+++.<+.>--.<<.>-.---------.<.>>+.--.<-..>+.<<[<++>-]<-.<]]]]

Main loop
The program consists of main loop (which isn't really a loop since all [ ] -blocks are executed only once) and two sections.
-+[[        // let answers enter
            * SNIP interleaved answer sections *
]]
++-+[[      // let odd answer and question enter
    +-+-[[  // let question enter
            * SNIP question section *
    ]]
]]

If you want to test sections independently, you must take the main loop into account. Location 0 contains -1 in even answer, 1 in odd answer and 2 in question section.
Answer section
Even answer (odd instructions removed):
// location 0 contains minus 1 from main
// set location 1 = 10 * 10 minus 1 = 99 (c)
+++++++++++[>++++++++++<-]>-. // c
++++++++++++.-.     // on
-----.---.          // if
-.+++++++++++++.+.  // ers
<                   // goto 0 (which contains 0)
+-+-+-+-+-          // padding to match length of odd answer

Odd answer (even instructions removed):
// location 0 contains 1 from main
// set location 1 = 16 * 6 plus 2 = 98 (b)  location used for characters below 'l'
// set location 2 = 16 * 7 plus 2 = 114 (r) location used for 'l' and above
+++++++++++++++[>++++++>+++++++<<-]>++.>++. // br
---.<               // o
-.+++.              // ad
>---.<              // l
+.----.+++++.       // eaf
>+++++++.           // s
>                   // goto 3 (which contains 0)

Question section
I decided to store space to separate location because its value differs drastically from other characters. This allows space to be printed simply with <.>.
// location 0 contains 2 from main
// set location 1 = 17 * 2 minus 2 = 32 (space)
// set location 2 = 17 * 5 plus 2 = 87 (W)   location used for characters below 'r'
// set location 3 = 17 * 7 minus 3 = 116 (t) location used for 'r' and above
+++++++++++++++[>++>+++++>+++++++<<<-]>-->>---<++. // W
+++++++++++++++++.  // h
-------.>.<         // at
<.>                 // (space)
.>--.<++++.         // are
<.>                 // (space)
>++.<+++.---.       // the
<.>                 // (space)
>.+++.<++++++++++.  // two
<.>                 // (space)
--.------------.    // ma
++++++++.+++++.     // in
<.>                 // (space)
-------.>-----.     // gr
<++++++++.>+++.     // ou
<+.>--.<            // ps
<.>                 // (space)
-.---------.        // of
<.>                 // (space)
>+.--.<-..>+.       // trees
<<[<++>-]<-.<       // ? (value_of_space * 2 minus 1)

Final update
In my final update I optimized multiplications so that minimum instructions are used. Also including 'l' to second character group in odd answer section proved to be huge improvement. Single character savings in odd answer basicly meant two characters from whole program, since it also reduces padding from the even answer. I also removed couple of unnecessary instructions from here and there and I don't think I can optimize the code any further.

Batch - 84
Quite proud of this one
Full program: What are two sides of a coin? (console)
echo What are two sides of a coin?  2>>xx  2>>cc&&eecchhoo  hteaaidlss  2>>xx  2>>cc

Evens only: heads ('c' file)
eh htaetosdso  on 2>x >c&echo heads 2>x >c

Odds only: tails ('x' file)
coWa r w ie faci? >x 2>c&echo tails >x 2>c

Works by redirecting the error output to a file in both cases.

Already thought of a way to make it shorter, but that'll have to wait till tomorrow.

This has the highest score so far: 12 - 28 = -16.

Python - 104 96 (golfed: 76)
My solution is rather simple (and somehow readable):
"";print 'What is the color of a zebra?' ;""
paraianat= "' b l a c k '"
aparaianat="'w h i t e'"

Output:
What is the color of a zebra?
black
white

Honestly, I found the idea for the first line in bitpwner's answer.

Even more readable alternative: - 113 105 97
"";print 'What is the color of a zebra?' ;""
"p r i n t ' b l a c k '" ;"p r i n t ' w h i t e '"

Even shorter alternative: - 86 76
"";print'What is the color of a zebra?';""
"""";;pprriinntt''bwlhaictke''"""

"chessboard" also fulfils the requirements.

@MartinBüttner Zebra. :-P

Oh, I like zebra. And it fits nicely into a "golfed" version with a question of exactly 30 characters. Thus I slightly modified my solution. :)

Aren't the triple quotation marks considered comments in python?

Triple-quoted strings are no comments, but multi-line strings. Since they are also used as doc strings, they might get confused with comments.

The updated question is only 29 characters long.

Perl 186 139 135
"";print'What are the best things in life?';""&&pprriinntt("'hceraurs ht hyeo ulra meennetmaiteiso'n s   o f   t h e i r   w o m e n ")

What are the best things in life?
"pitWa r h ettig nlf?;"&print('crush your enemies'                 )

crush your enemies
";rn'htaetebs hnsi ie'"&print"hear the lamentations of their women"

hear the lamentations of their women
Using less lengthy answers:
Perl 79 72
"";print'What are my preferred weapons?';""&&pprriinntt("'smwaocredss'")

What are my preferred weapons? (30Byte, H(X)=3.76) swords (H(X)=2,25) and maces (H(X)=2,32)

Rebmu: 79 chars OR (37 + length(p1) + 2 * max(length(p2), length(p3)))
First I'll give a 79 character solution that asks Which languages must you learn? (entropy 4.0, 30 letters not including ?) and offers you the suggestions of Rebol and [Red]:
DD  11  DD :do dd {dd  {p{Which languages must you learn?}qt}} pp{{[RReebdo]l}}

A unique tactic available here that isn't in other languages comes from taking advantage of the fact that curly braces are an asymmetric string delimiter, that can nest legally:
my-string: {"It's cool," said {Dr. Rebmu}, "for MANY reasons--like less escaping."}

That let me produce a generalized solution, that can work effortlessly on any program that doesn't use escape sequences.  The 79 character version was simple enough to shortcut, but to properly contain arbitrary program source for programs p2 and p3 you'd need the full template. Had we used that, it would have been 87 characters:
DD  11  DD :do dd {dd  {p{Which languages must you learn?}qt}} ddoo{{pp{{[RReebdo]l}}}}

The pattern for using this general form is that if you have three source texts of sequential characters of variable lengths (let's use an example like AAA, BBBBB, CCCCCCC) you can encode them as something along the lines of:
DD  11  DD :do dd {dd  {AAAqt}} ddoo{{BCBCBCBCBC C C}}

(Note: Although this pattern won't work without tweaking on programs that use escape characters, this is not a fatal flaw.  Getting an unmatched left brace in a string delimited by braces requires something like {Foo ^{ Bar}...but you could easily rewrite that using the alternative string notation "Foo { Bar", and combined cases can be managed with gluing together a mixture of unescaped strings.)
So...how about an example?  Once the general form was available, this 573 character program was assembled in only a couple of minutes from 3 prior code golf solutions:

DD  11  DD :do dd {dd  {rJ N 0% rN Wa1m2j S{ \x/ }D00 Hc&[u[Ze?Wa Qs~rpKw[isEL00c[skQd2k][eEV?kQ[tlQ]]pcSeg--b00[eZ 1 5]3]prRJ[si~dSPscSqFHs]eZ 1[s+dCa+wM2cNO]]]Va|[mpAp2j]prSI~w{}Ls2w Wl h01tiVsb01n -1 chRVs{}hLceVn01qt}} ddoo{{BrdSz [fcebC[sn[{N sbeo[tIt0l1eV}0e5gXN1 01L{5s0}C{1}0{0 Do5f0 0bMe1e0r0}0]]]tMw9C9 Numz Jl[paN+[KperlCJBn[[ba sWS{B noJn  Nt0h0e] jw]aJlnl]}aCd{K,j  } b   P { . } l f E Z - - n [ N m { G o   t o   t h e   s t o r e   a n d   b u y   s o m e   m o r e } ] { T a k e   o n e   d o w n   a n d   p a s s   i t   a r o u n d } c B w P l f ] ] }}

If you don't modify the program, it is the Hourglass Solution.
If you take only the odd characters and run it, then it will print out the 99 bottles of beer poem
Only the even characters will do a little Roman Numeral Conversion for you.

If anyone wants to try writing that program in their language of choice, and thinks they can beat 573, let me know.  I will bounty you a heavy amount of reputation if you do--assuming your language of choice is not Rebmu, because I know those programs aren't minimal.  :-)
That "wasteful" spacing you get at the end is what happens when p2 and p3 are of imbalanced lengths.  But all 3 programs are different sizes in this case so there isn't a particular good pairing to pick for p2/p3.  (I picked these because there was no external data as input, such as a maze or whatever, not that they were of similar lengths.  While I could have written new programs that were more optimal, I've spent enough time and the point was you don't have to write new programs...)
How it works
(Note: I started with a more "creative" approach that was not as streamlined but more interesting-looking.  I moved it to an entry on my blog as describing this approach is already long.)
A key here is the "eval code as a string" trickery like some other entries, it just has the trump card of the asymmetric string delimiter. I'll start by explaining the workings of the 80 character case.
Here's the "whole" program, adjusting the whitespace for this case's readability:
DD 11                    ; assign 11 to dd (about to overwrite again)
DD :do                   ; make dd a synonym for DO (a.k.a. "eval")

; eval a string as source code that ends with QUIT (QT)
dd {dd  {p{Which languages must you learn?}qt}}

; we'll never get here, but whatever's here must be legally parseable
pp{{[RReebdo]l}}

Here we wind up setting DD to a synonym for DO (a.k.a. "eval").  But the trick is that when the halved programs run, they wind up running code whose only effect is to define D to the harmless literal 1.
Here's what the odd-chars code makes, whitespace again adjusted:
D 1                      ; assign 1 to d
D d                      ; assign d to itself, so it's still 1
d                        ; evaluates to integer, no side effect
{d pWihlnugsms o er?q}   ; string literal, no side effect
p {Rebol}                ; print "Rebol"

And here's the even-chars code:
D 1                      ; assign 1 to d
D:od                     ; URL-literal (foo:...), no side effect
d                        ; evaluates to integer, no side effect
{{hc agae utyulan}t}     ; string literal (well-formed!), no side effect
p {[Red]}                ; print "[Red]"

It's actually the case that for the non-halved program, the dd {dd  {(arbitrary code)qt}} will execute whatever code you want.  However, there are two calls to evaluate instead of just one.  That's because while the nested braces work great in the interleaved code, they mess up the eval behavior of DO.  Because:
do {{print "Hello"}}

Will load the string as a program, but that program winds up being just the string constant {print "Hello"}.  Thus the trick I use here is to take my DD (holding the same function value as DO) and run it twice.  The halvers chew at the different parts of the string but they don't chew both if the even/oddness is correct for the content, and because what's left outside the string after halving is just the integral constant d they're harmless.
With this pattern there's no challenge in writing the program behavior when it's not cut in half--you can put in anything as long as the character length of the code is even (odd if you're counting the QT, which is QUIT).  If you need to get the even number from an odd one, throw in a space (so there's actually a +1 in my formula above on p1 for odd program lengths of p1).  The trick would seem to write that interleaved code afterwards, which must pass the parser if it isn't halved.  (It won't be run because of the QT, but it has to be LOADable before it will be executed.)
This case is trivial; pp loads fine as a symbol even though it's undefined, and is split into p for print in each half program.  But we can do another trick just by using a string literal again.  The halved programs still have DO defined normally, so we could also have just said:
ddoo{{pp{{[RReebdo]l}}}}

By having the only part picked up by the parser in the whole case be the symbolic word ddoo and a string literal, we can then interleave any two programs we wish inside that string literal and not anger the parser.  The halved versions will just say:
do{p{Rebol}}

..and...
do{p{[Red]}}

As I say, this part looks familiar to other solutions that treat programs as strings and eval them.  But in the competition's case, when the programs you're packing contain nested strings, that throws in wrenches for them.  Here the only things that will get you in trouble are use of escaping via carets (^)...which can be easily worked around.

(Small 'cheating' note: I added QT for "QUIT" in response to this problem.  Actually, I had purposefully removed the abbreviation for quit before...because somehow I thought it was only good for console use and just taking up the two-letter space if it wasn't in a REPL.  I'm adding it because I see I was wrong, not adding it for this case in particular.  Nevertheless, prior to that change it would have been 2 characters longer.  Also, when I first posted the solution there was a bug in Rebmu that kept it from actually working even though it should have...now it works.)

You actually created your own programming language?

@tjt263 It's better thought of a code-golf "encoding" of the existing language Rebol.  People have done similar things for instance with Pyth, which basically abbreviates Python.  But Rebmu has a fairly interesting difference in that it's actually loadable by the Rebol parser, and "compatible".  You can break into Rebol at any time in the middle of it, see for instance Hourglass.  Happy to discuss it in Rebol and Red chat if you wish.

Python - 139 103
"";print'What are the ingredients for success?';""; ";" ;id=='"RUaniincboorwnss'";;pprriinntt  id++"'"'

What are the ingredients for success? -> Unicorns and Rainbows
Test:
c="\"\";print\'What are the ingredients for success?\';\"\"; \";\" ;id==\'\"RUaniincboorwnss\'\";;pprriinntt  id++\"\'\"\'"
exec c        # What are the ingredients for success?
exec c[::2]   # Unicorns
exec c[1::2]  # Rainbows
print
print c[::2]  # ";rn'htaeteigeinsfrsces'";"";d="Unicorns";print d+''
print c[1::2] # "pitWa r h nrdet o ucs?;" ; i='Rainbows';print i+""

Old version:
# What are the ingredients for success?
"";print(('What are the ingredients for success?'));""; ";" ;"pHrEiRnEt (C'OUMnEiSc oZrAnLsG'O)"; ";" ; "p,r iTnOtN(Y' RTaHiEn bPoOwNsY'.)"
# Unicorns
";rn('htaeteigeinsfrsces')";"";print('Unicorns');"";", TONY THE PONY."
# Rainbows
"pit(Wa r h nrdet o ucs?);" ; "HERE COMES ZALGO" ;  print('Rainbows')

Haskell, 117
Having to work with Haskell's functional paradigm means that everything has to be assigned to a variable or commented out with line -- or block {- -} comments; having nonsense functions run without assignment is out. So, to keep myself sane, I kept the question and answers as short as the rules allow.
Question: What can I not have enough of?
main=putStrLn{---}"What can I not have enough of?"{- }
=u"Scrank=e"sS"h
omeasi"n
=mpauitnS=tpru taSntprt tmLi

-----}

"Shoes" and "cakes":
mi=uSrn--"htcnInthv nuho?{
uSrn="Shoes"
main=putStr mi
--}

anpttL{-}Wa a  o aeeog f"-}="cakes"
main=putStr anpttL
---

N.B. The appearance of crank under "What can I not have enough of?" should not be viewed as meaningful.

Comments are not allowed

And how the second one is valid haskell syntax?

the original code has an unclosed comment block because the closing pair is in a line comment. the "cakes" code doesn't even seem like code - isn't anpttL a function? where is the = sign in it's definition? isn't it actually called anpttLWa ?

@proudhaskeller Missed the rule about comments. Sorry about that. The first program does not have an unclosed comment block. It parses just fine. Line comments are meaningless within block comments. The second one is valid because line comments are valid. anpttL is a string. Take out the block comment and you'll see it equals "cakes". Wa is in the block comment, so, no, it's not actually anpttLWa.

oh i see now. appearently i can't parse in my head :-).

@proudhaskeller My head lets GHCi do the work on its behalf.

Lisp (76 characters)
31-character question, 6 characters in each answer ⟹ length - payload = 33
'(: (pprriinncc''fmuacghesnitaa))':(princ "What is your favorite pink hue?")

I wanted to use “What is your favorite color?”, but even stretched to British spelling, it only just reached the 30-character minimum for the question length, and I needed an odd-length question to balance the double quotes.
They say Common Lisp is verbose, but you wouldn't think so going by this one-liner. It's not even very obfuscated, you only need to insert a bit of whitespace to see what's getting quoted and what's getting executed.
Many Lisp implementations will shout out the colors, because they warp symbols to uppercase. If that bothers you, change ''fmuacghesnitaa to ""fmuacghesnitaa"".

Because this question had a voting component, I bountied it to draw attention to try and get more votes.  But the bounty has run out and as I can't give myself the points :-) I'll give it to your entry based on Rebmu's ancestor language, and encourage you to check it out if you haven't before!  http://codegolf.stackexchange.com/a/36114/57

STATA 295
Question: What are the best desserts to bake right now?
Answer: brownies and cookies.
Explanation:
Commands in STATA are delimited by new lines.
While "//" is a comment in STATA, "///" tells the compiler to continue to the next line and include its contents in the current command.

Commands in STATA can often be abbreviated to the point where they are considered unique enough to be differentiable (so "generate" becomes "g", "global" becomes "gl" or "glo", "capture" becomes "cap", "display" becomes "di", etc.). The display command displays text to the screen. The capture command captures all errors (including syntax errors), which is why this program compiles properly.

I guess if you want to get picky, any additional "/" after the first 3 consecutive ones in a line are ignored by the compiler. Also, in the "brownies" program, technically    +"  " is a comment. But I claim that it still counts because the capture command would still have made it irrelevant even if it wasn't a comment.

Thanks for reading my really long explanation. Now for the code:

"What are the best desserts to bake right now?"
g   a = "g   q   /b/a/"
g l= "b = ""b r o w n i e s "
g   c = "g   /b/a/"
g lpo= "d = ""c o o k i e s "
g   e = "c a p  "  /////
 +  "d i ""$ b "
g   f = "c a p  "  /////
 +  "d i ""$ d "
g   g = "c a p  "  /////
 + "c a p   / / /  "+ "/ / /"
di "What are the best desserts to bake right now?"

"brownies"
g a="    ba"
gl b="brownies"
    g ///
 p="  "
g e="   " //
 di "$b"
    cap ///
+" "
g g="   " //
  cap ///   +"  "
i"htaetebs esrst aergtnw"

"cookies"
    g q ///
 ="  "
g c="  ba"
glo d="cookies"
    cap ///
+" "
g f="   " //
 di "$d"
    cap  ///
+ "       " ///
d Wa r h etdset obk ih o?

Ksh (82 characters)
35-character question, 5 characters in each answer ⟹ length - payload = 37
ec=\'o'(;)eehc(h)oe cChroi m$e1;; '\'
echo  What\'s the  country\'s worst problem?

I abuse the function definition syntax beyond POSIX. Dash and bash can't take it but ksh (public domain or ATT) can.
Nothing remarkable going on, just a bit of echo. Waste not, want not.

PowerShell 88
"" > $x;{What is my favorite equipment?};"" >> ${x}

${XsXwXoXrXdX};;;${XsXhXiXeXlXdX}

What is my favorite equipment? (30 chars, H(X) = 4.0314)
"  x{hti yfvrt qimn?;"> {}
{sword};$XXXXXXX

sword (5 chars, H(X) = 2.32193)
">$;Wa sm aoieeupet}" >$x
$XXXXXX;;{shield}

shield (5 chars, H(X) = 2.58496)
On the full program it redirects empty strings to a nonexistent variable ${x} (the quotes for those empty strings are used to form a nonsense string that gets redirected either to an empty block {} or nonexistent variable $x on the even/odd versions), then prints the question and declares 2 unused variables (which are printed and placed next to another unused variable $XXXXXX or $XXXXXXX on the different cases).

GolfScript, 51 bytes
"Which are the sides of a coin? ".;""thaeialdss""

Output
Which are the sides of a coin?

How it works
.; duplicates the string and deletes the copy. "" pushes an empty string. thaeialdss is undefined, so it does nothing.
Odd chars
"hc r h ie faci?";"heads"

Output
heads

How it works
; deletes the first string from the stack.
Even chars
Wihaetesdso  on ."tails"

Output
tails

How it works
Wihaetesdso and on are noops. . duplicates the empty string on the stack.


text:
Find the craftiest prime
Intro
Consider the process of taking some positive integer n in some base b and replacing each digit with its representation in the base of the digit to the right.

If the digit to the right is a 0, use base b.
If the digit to the right is a 1, use unary with 0's as tally marks.
If there is no digit to the right (i.e. you are in the ones place), loop around to the most significant digit.

As an example let n = 160 and b = 10. Running the process looks like this:
The first digit is 1, the digit to the right is 6, 1 in base 6 is 1.
The next digit is 6, the digit to the right is 0, 0 is not a base so use b, 6 in base b is 6.
The last digit is 0, the digit to the right (looping around) is 1, 0 in base 1 is the empty string (but that's ok).

Concatenating '1', '6', and '' together gives 16, which is read in the original base b = 10.

The exact same procedure but moving left instead of right can also be done:
The first digit is 1, the digit to the left (looping around) is 0, 0 is not a base so use b, 1 in base b is 1.
The next digit is 6, the digit to the left is 1, 6 in base 1 is 000000.
The last digit is 0, the digit to the left is 6, 0 in base 6 is 0.

Concatenating '1', '000000', and '0' together gives 10000000, which is read in the original base b = 10.

Thus, we've made two numbers related to 160 (for b = 10): 16 and 10000000.
We will define n to be a crafty number if it evenly divides at least one of the two numbers generated in this process into 2 or more parts
In the example n is crafty because 160 divides 10000000 exactly 62500 times.
203 is NOT crafty because the resulting numbers are 2011 and 203 itself, which 203 cannot fit evenly into 2 or more times.
Challenge
(For the rest of the problem we will only consider b = 10.)
The challenge is to write a program that finds the highest crafty number that is also prime.
The first 7 crafty primes (and all that I have found so far) are:
2
5
3449
6287
7589
9397
93557 <-- highest so far (I've searched to 100,000,000+)

I am not officially certain whether more exist, but I expect they do. If you can prove that there are (or aren't) finitely many I'll give you +200 bounty rep.
The winner will be the person who can provide the highest crafty prime, provided it is apparent that they have been active in the search and are not intentionally taking glory from others.
Rules

You may use any prime finding tools you want.
You may use probabilistic prime testers.
You may reuse other peoples code with attribution. This is a communal effort. Cutthroat tactics will not be tolerated.
Your program must actively search for the prime. You may start your search at the highest known crafty prime.
Your program should be able to compute all of the known crafty primes within 4 hours of Amazon EC2 t2.medium instances (either four at once or one for four hours or something in between). I will not actually be testing it on them and you certainly don't need to. This is just a benchmark.

Here is my Python 3 code I used for generating the table above: (runs in a second or two)
import pyprimes

def toBase(base, digit):
    a = [
            ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
            ['', '0', '00', '000', '0000', '00000', '000000', '0000000', '00000000', '000000000' ],
            ['0', '1', '10', '11', '100', '101', '110', '111', '1000', '1001'],
            ['0', '1', '2', '10', '11', '12', '20', '21', '22', '100'],
            ['0', '1', '2', '3', '10', '11', '12', '13', '20', '21'],
            ['0', '1', '2', '3', '4', '10', '11', '12', '13', '14'],
            ['0', '1', '2', '3', '4', '5', '10', '11', '12', '13'],
            ['0', '1', '2', '3', '4', '5', '6', '10', '11', '12'],
            ['0', '1', '2', '3', '4', '5', '6', '7', '10', '11'],
            ['0', '1', '2', '3', '4', '5', '6', '7', '8', '10']
        ]
    return a[base][digit]

def getCrafty(start=1, stop=100000):
    for p in pyprimes.primes_above(start):
        s = str(p)
        left = right = ''
        for i in range(len(s)):
            digit = int(s[i])
            left += toBase(int(s[i - 1]), digit)
            right += toBase(int(s[0 if i + 1 == len(s) else i + 1]), digit)
        left = int(left)
        right = int(right)
        if (left % p == 0 and left // p >= 2) or (right % p == 0 and right // p >= 2):
            print(p, left, right)
        if p >= stop:
            break
    print('DONE')

getCrafty()

I think that making 0 in any base x to be the empty string would be more mathematical. Also, I'm sure it would be easier to prove or disprove this version

Mathematica, finds 93,557 in 0.3s (no further crafty primes below 2*1010)
This is just a naive exhaustive search through all primes. To begin with it checks about 1,000,000 primes every 55 seconds (which is bound to get slower as the primes get larger).
I'm using a bunch of helper functions:
lookup = {
  {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
  {{}, 0, {0, 0}, {0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}},
  {0, 1, {1, 0}, {1, 1}, {1, 0, 0}, {1, 0, 1}, {1, 1, 0}, {1, 1, 1}, {1, 0, 0, 0},
   {1, 0, 0, 1}},
  {0, 1, 2, {1, 0}, {1, 1}, {1, 2}, {2, 0}, {2, 1}, {2, 2}, {1, 0, 0}},
  {0, 1, 2, 3, {1, 0}, {1, 1}, {1, 2}, {1, 3}, {2, 0}, {2, 1}},
  {0, 1, 2, 3, 4, {1, 0}, {1, 1}, {1, 2}, {1, 3}, {1, 4}},
  {0, 1, 2, 3, 4, 5, {1, 0}, {1, 1}, {1, 2}, {1, 3}},
  {0, 1, 2, 3, 4, 5, 6, {1, 0}, {1, 1}, {1, 2}},
  {0, 1, 2, 3, 4, 5, 6, 7, {1, 0}, {1, 1}},
  {0, 1, 2, 3, 4, 5, 6, 7, 8, {1, 0}}
};
convertBase[d_, b_] := lookup[[b + 1, d + 1]];
related[n_] := (
   d = IntegerDigits[n];
   {FromDigits[Flatten[convertBase @@@ Transpose[{d, RotateRight@d}]]],
    FromDigits[Flatten[convertBase @@@ Transpose[{d, RotateLeft@d}]]]}
);
crafty[n_] := (
   {ql, qr} = related[n]/n;
   IntegerQ[ql] && ql > 1 || IntegerQ[qr] && qr > 1
);

And then this loop does the actual search:
p = 2;
start = TimeUsed[];
i = 1;
While[True,
 If[crafty[p], Print@{"CRAFTY PRIME:", p, TimeUsed[] - start}];
 p = NextPrime@p;
 If[Mod[++i, 1000000] == 0,
  Print[{"Last prime checked:", p, TimeUsed[] - start}]
 ]
]

I'll keep updating the post, if I find any primes or can think of optimisations.
It currently checks all primes up to 100,000,000 in about 5.5 minutes.
Edit: I decided to follow the OP's example and switched to a lookup table for base conversion. That gave roughly a 30% speedup.
Crafty Numbers in general
I'm stopping my search for crafty primes now, since I'd need several days just to catch up with where the Perl answer already got. Instead, I started searching for all crafty numbers. Maybe their distribution helps to find a proof the the number of crafty primes is finite or infinite.
I define right-crafty numbers those which divide the related number obtained by interpreting the digit to the right as the new base, and left-crafty numbers accordingly. It will probably help to tackle these individually for a proof.
Here are all left-crafty numbers up to 2,210,000,000:
{2, 5, 16, 28, 68, 160, 222, 280, 555, 680, 777, 1600, 2605, 2800,
 6800, 7589, 7689, 9397, 9777, 16000, 16064, 16122, 22222, 24682,
 26050, 28000, 55555, 68000, 75890, 76890, 93557, 160000, 160640,
 161220, 247522, 254408, 260500, 280000, 680000, 758900, 768900,
 949395, 1600000, 1606400, 1612200, 2222222, 2544080, 2605000,
 2709661, 2710271, 2717529, 2800000, 3517736, 5555555, 6800000,
 7589000, 7689000, 9754696, 11350875, 16000000, 16064000, 16122000,
 25440800, 26050000, 27175290, 28000000, 28028028, 35177360, 52623721,
 68000000, 68654516, 75890000, 76890000, 113508750, 129129129, 160000000,
 160640000, 161220000, 222222222, 254408000, 260500000, 271752900,
 275836752, 280000000, 280280280, 333018547, 351773600, 370938016,
 555555555, 680000000, 758900000, 768900000, 777777777, 877827179,
 1135087500, 1291291290, 1600000000, 1606400000, 1612200000, 1944919449}

And here are all right-crafty numbers in that range:
{2, 5, 16, 28, 68, 125, 128, 175, 222, 284, 555, 777, 1575, 1625,
 1875, 3449, 5217, 6287, 9375, 14625, 16736, 19968, 22222, 52990,
 53145, 55555, 58750, 93750, 127625, 152628, 293750, 529900, 587500,
 593750, 683860, 937500, 1034375, 1340625, 1488736, 2158750, 2222222,
 2863740, 2937500, 5299000, 5555555, 5875000, 5937500, 6838600,
 7577355, 9375000, 12071125, 19325648, 21587500, 28637400, 29375000,
 29811250, 42107160, 44888540, 52990000, 58750000, 59375000, 68386000,
 71461386, 74709375, 75773550, 93750000, 100540625, 116382104,
 164371875, 197313776, 207144127, 215875000, 222222222, 226071269,
 227896480, 274106547, 284284284, 286374000, 287222080, 293750000,
 298112500, 421071600, 448885400, 529900000, 555555555, 587500000,
 593750000, 600481125, 683860000, 714613860, 747093750, 757735500,
 769456199, 777777777, 853796995, 937500000, 1371513715, 1512715127,
 1656354715, 1728817288, 1944919449, 2158750000}

Note that there's an infinite number of left-crafty and right-crafty numbers, because there are several ways to generate them from existing ones:

One can append an arbitrary number of 0s to any left-crafty number whose least significant digit is greater than its most significant digit to obtain another left-crafty number.
Likewise, one can append an arbitrary number of 0s to any right-crafty number whose least significant digit in less than its most significant digit. This (and the previous statement) is because the 0 will be appended to both the crafty number and its related number, effectively multiplying both of them by 10.
Every odd number of 2s or 5s is crafty.
Every odd number of 777s is crafty.
It appears that an odd number of 28 joined by 0s, like 28028028 is always left-crafty.

Other things to note:

There are at least four 10-digit numbers which consist of two repeated five-digit numbers (which are themselves not crafty, but there might be some pattern here anyway).
There are a lot of right-crafty numbers that are a multiple of 125. It might be worth investigating those to find another production rule.
I haven't found a left-crafty number that starts with 4 or ends with 3.
Right-crafty numbers can start with any digit but I haven't found a right-crafty number ending in 1 or 3.

I suppose this list would be more interesting if I omitted those whose existence is implied by a smaller crafty number, especially since these are never primes by the construction rules discovered so far. So here are all crafty primes that cannot constructed with one of the above rules:
Left-crafty:
{16, 68, 2605, 7589, 7689, 9397, 9777, 16064, 16122, 24682,
 93557, 247522, 254408, 949395, 2709661, 2710271, 2717529, 3517736,
 9754696, 11350875, 52623721, 68654516, 129129129, 275836752,
 333018547, 370938016, 877827179, 1944919449}

Right-crafty:
{16, 28, 68, 125, 128, 175, 284, 1575, 1625, 1875, 3449, 5217,
 6287, 9375, 14625, 16736, 19968, 52990, 53145, 58750, 127625,
 152628, 293750, 593750, 683860, 1034375, 1340625, 1488736, 2158750,
 2863740, 7577355, 12071125, 19325648, 29811250, 42107160, 44888540,
 71461386, 74709375, 100540625, 116382104, 164371875, 197313776,
 207144127, 226071269, 227896480, 274106547, 284284284, 287222080,
 600481125, 769456199, 853796995, 1371513715, 1512715127, 1656354715,
 1728817288, 1944919449}

Note also that there a few doubly-crafty numbers (those which appear in both lists and hence divide both related numbers):
{2, 5, 16, 28, 68, 222, 555, 777, 22222, 55555, 2222222, 5555555, 1944919449}

There exist infinitely many of these as well. But as you can see, except for 16, 28, 68 these all consist only of a single (repeated) digit. It would also be interesting prove whether any larger numbers can be doubly crafty without having that property, but that might just drop out as a corollary of a proof for singly crafty numbers. Found the counter-example 1944919449.

Is there any reason you have 100540625, 100540625 in your right-crafty list?

@isaacg yes. because I can't copy and paste.

Accepting this since no one found crafty primes beyond 93,557. This was the first answer, is highest voted, and goes into the most depth.

Perl (1e5 in 0.03s, 1e8 in 21s).  Max 93557 to 1e11.
Very similar to the original.  Changes include:

transpose the base lookup.  Small language-dependent savings.
mod the incremented right shift instead of if.  Language dependent micro-opt.
use Math::GMPz because Perl 5 doesn't have auto-magic bigints like Python and Perl 6.
Use 2s <= left instead of int(left/s) >= 2.  Native integer shift vs. bigint divide.

Does first 1e8 primes in 21 seconds on my fast machine, 3.5 minutes for 1e9, 34 minutes for 1e10.  I'm a little surprised it is at all faster than the Python code for small inputs.  We could parallelize (Pari/GP's new parforprime would be nice for this).  Since it is a search we can parallelize by hand I suppose (forprimes can take two arguments).  forprimes is basically like Pari/GP's forprime -- it does segmented sieves internally and calls the block with each result.  It's convenient, but for this problem I don't think it is a performance area.
#!/usr/bin/env perl
use warnings;
use strict;
use Math::Prime::Util qw/forprimes/;
use Math::GMPz;

my @rbase = (
  [   0,"",       0,   0,  0, 0, 0, 0, 0, 0],
  [qw/1 0         1    1   1  1  1  1  1  1/],
  [qw/2 00        10   2   2  2  2  2  2  2/],
  [qw/3 000       11   10  3  3  3  3  3  3/],
  [qw/4 0000      100  11  10 4  4  4  4  4/],
  [qw/5 00000     101  12  11 10 5  5  5  5/],
  [qw/6 000000    110  20  12 11 10 6  6  6/],
  [qw/7 0000000   111  21  13 12 11 10 7  7/],
  [qw/8 00000000  1000 22  20 13 12 11 10 8/],
  [qw/9 000000000 1001 100 21 14 13 12 11 10/],
);

my($s,$left,$right,$slen,$i,$barray);
forprimes {
  ($s,$slen,$left,$right) = ($_,length($_),'','');
  foreach $i (0 .. $slen-1) {
    $barray = $rbase[substr($s,$i,1)];
    $left  .= $barray->[substr($s,$i-1,1)];
    $right .= $barray->[substr($s,($i+1) % $slen,1)];
  }
  $left = Math::GMPz::Rmpz_init_set_str($left,10) if length($left) >= 20;
  $right = Math::GMPz::Rmpz_init_set_str($right,10) if length($right) >= 20;
  print "$s      $left $right\n" if (($s<<1) <= $left && $left % $s == 0)
                                 || (($s<<1) <= $right && $right % $s == 0);
} 1e9;

C++11, with threads and GMP
Timing (on a MacBook Air):

4 threads

10^8 in 2.18986s
10^9 in 21.3829s
10^10 in 421.392s
10^11 in 2557.22s

1 thread

10^8 in 3.95095s
10^9 in 37.7009s

Requirements:

Needs https://github.com/kimwalisch/primesieve and https://gmplib.org/
Compile: g++ crafty.cpp -o crafty --std=c++11 -ffast-math -lprimesieve -O3 -lgmpxx -lgmp -Wall -Wextra

#include <vector>
#include <iostream>
#include <chrono>
#include <cmath>
#include <future>
#include <mutex>
#include <atomic>
#include "primesieve.hpp"
#include "gmpxx.h"

using namespace std;

using ull = unsigned long long;

mutex cout_mtx;
atomic<ull> prime_counter;

string ppnum(ull number) {
    if (number == 0) {
        return "0 * 10^0";
    }
    else {
        int l = floor(log10(number));
        return to_string(number / pow(10, l)) + " * 10^" + to_string(int(l));
    }
}

inline void bases(int& base, int& digit, mpz_class& sofar) {
    switch (base) {
        case 0:
            sofar *= 10;
            sofar += digit;
            break;
        case 1:
            sofar *= pow(10, digit);
            break;
        case 2:
            switch (digit) {
                case 0: sofar *= 10; break;
                case 1: sofar *= 10; sofar += 1; break;
                case 2: sofar *= 100; sofar += 10; break;
                case 3: sofar *= 100; sofar += 11; break;
                case 4: sofar *= 1000; sofar += 100; break;
                case 5: sofar *= 1000; sofar += 101; break;
                case 6: sofar *= 1000; sofar += 110; break;
                case 7: sofar *= 1000; sofar += 111; break;
                case 8: sofar *= 10000; sofar += 1000; break;
                case 9: sofar *= 10000; sofar += 1001; break;
            }
            break;
        case 3:
            switch (digit) {
                case 0: sofar *= 10; break;
                case 1: sofar *= 10; sofar += 1; break;
                case 2: sofar *= 10; sofar += 2; break;
                case 3: sofar *= 100; sofar += 10; break;
                case 4: sofar *= 100; sofar += 11; break;
                case 5: sofar *= 100; sofar += 12; break;
                case 6: sofar *= 100; sofar += 20; break;
                case 7: sofar *= 100; sofar += 21; break;
                case 8: sofar *= 100; sofar += 22; break;
                case 9: sofar *= 1000; sofar += 100; break;
            }
            break;
        case 4:
            switch (digit) {
                case 0: sofar *= 10; break;
                case 1: sofar *= 10; sofar += 1; break;
                case 2: sofar *= 10; sofar += 2; break;
                case 3: sofar *= 10; sofar += 3; break;
                case 4: sofar *= 100; sofar += 10; break;
                case 5: sofar *= 100; sofar += 11; break;
                case 6: sofar *= 100; sofar += 12; break;
                case 7: sofar *= 100; sofar += 13; break;
                case 8: sofar *= 100; sofar += 20; break;
                case 9: sofar *= 100; sofar += 21; break;
            }
            break;
        case 5:
            switch (digit) {
                case 0: sofar *= 10; break;
                case 1: sofar *= 10; sofar += 1; break;
                case 2: sofar *= 10; sofar += 2; break;
                case 3: sofar *= 10; sofar += 3; break;
                case 4: sofar *= 10; sofar += 4; break;
                case 5: sofar *= 100; sofar += 10; break;
                case 6: sofar *= 100; sofar += 11; break;
                case 7: sofar *= 100; sofar += 12; break;
                case 8: sofar *= 100; sofar += 13; break;
                case 9: sofar *= 100; sofar += 14; break;
            }
            break;
        case 6:
            switch (digit) {
                case 0: sofar *= 10; break;
                case 1: sofar *= 10; sofar += 1; break;
                case 2: sofar *= 10; sofar += 2; break;
                case 3: sofar *= 10; sofar += 3; break;
                case 4: sofar *= 10; sofar += 4; break;
                case 5: sofar *= 10; sofar += 5; break;
                case 6: sofar *= 100; sofar += 10; break;
                case 7: sofar *= 100; sofar += 11; break;
                case 8: sofar *= 100; sofar += 12; break;
                case 9: sofar *= 100; sofar += 13; break;
            }
            break;
        case 7:
            switch (digit) {
                case 0: sofar *= 10; break;
                case 1: sofar *= 10; sofar += 1; break;
                case 2: sofar *= 10; sofar += 2; break;
                case 3: sofar *= 10; sofar += 3; break;
                case 4: sofar *= 10; sofar += 4; break;
                case 5: sofar *= 10; sofar += 5; break;
                case 6: sofar *= 10; sofar += 6; break;
                case 7: sofar *= 100; sofar += 10; break;
                case 8: sofar *= 100; sofar += 11; break;
                case 9: sofar *= 100; sofar += 12; break;
            }
            break;
        case 8:
            switch (digit) {
                case 0: sofar *= 10; break;
                case 1: sofar *= 10; sofar += 1; break;
                case 2: sofar *= 10; sofar += 2; break;
                case 3: sofar *= 10; sofar += 3; break;
                case 4: sofar *= 10; sofar += 4; break;
                case 5: sofar *= 10; sofar += 5; break;
                case 6: sofar *= 10; sofar += 6; break;
                case 7: sofar *= 10; sofar += 7; break;
                case 8: sofar *= 100; sofar += 10; break;
                case 9: sofar *= 100; sofar += 11; break;
            }
            break;
        case 9:
            switch (digit) {
                case 0: sofar *= 10; break;
                case 1: sofar *= 10; sofar += 1; break;
                case 2: sofar *= 10; sofar += 2; break;
                case 3: sofar *= 10; sofar += 3; break;
                case 4: sofar *= 10; sofar += 4; break;
                case 5: sofar *= 10; sofar += 5; break;
                case 6: sofar *= 10; sofar += 6; break;
                case 7: sofar *= 10; sofar += 7; break;
                case 8: sofar *= 10; sofar += 8; break;
                case 9: sofar *= 100; sofar += 10; break;
            }
            break;
    };
}

vector<ull> crafty(ull start, ull stop) {
    cout_mtx.lock();
    cout << "Thread scanning from " << start << " to " << stop << endl;
    cout_mtx.unlock();
    vector<ull> res;

    auto prime_iter = primesieve::iterator(start);
    ull num;
    int prev, curr, next, fprev;
    int i, size;
    mpz_class left, right;
    unsigned long num_cpy;
    unsigned long* num_ptr;
    mpz_class num_mpz;

    while ((num = prime_iter.next_prime()) && num < stop) {
        ++prime_counter;
        left = 0;
        right = 0;
        size = floor(log10(num));
        i = pow(10, size);
        prev = num % 10;
        fprev = curr = num / i;
        if (i != 1) {
            i /= 10;
            next = (num / i) % 10;
        }
        else {
            next = prev;
        }
        for (size += 1; size; --size) {
            bases(prev, curr, left);
            bases(next, curr, right);
            prev = curr;
            curr = next;
            if (i > 1) {
                i /= 10;
                next = (num / i) % 10;
            }
            else {
                next = fprev;
            }
        }
        num_cpy = num;

        if (num != num_cpy) {
            num_ptr = (unsigned long *) #
            num_mpz = *num_ptr;
            num_mpz << sizeof(unsigned long) * 8;
            num_mpz += *(num_ptr + 1);
        }
        else {
            num_mpz = num_cpy;
        }
        if ((left % num_mpz == 0 && left / num_mpz >= 2) || (right % num_mpz == 0 && right / num_mpz >= 2)) {
            res.push_back(num);
        }
    }
    cout_mtx.lock();
    cout << "Thread scanning from " << start << " to " << stop << " is done." << endl;;
    cout << "Found " << res.size() << " crafty primes." << endl;
    cout_mtx.unlock();
    return res;
}

int main(int argc, char *argv[]) {
    ull start = 0, stop = 1000000000;
    int number_of_threads = 4;

    if (argc > 1) {
        start = atoll(argv[1]);
    }
    if (argc > 2) {
        stop = atoll(argv[2]);
    }
    if (argc > 3) {
        number_of_threads = atoi(argv[3]);
    }
    ull gap = stop - start;

    cout << "Start: " << ppnum(start) << ", stop: " << ppnum(stop) << endl;
    cout << "Scanning " << ppnum(gap) << " numbers" << endl;
    cout << "Number of threads: " << number_of_threads << endl;

    chrono::time_point<chrono::system_clock> tstart, tend;
    tstart = chrono::system_clock::now();

    cout << "Checking primes..." << endl;

    using ptask = packaged_task<decltype(crafty)>;
    using fur = future<vector<ull>>;

    vector<thread> threads;
    vector<fur> futures;
    for (int i = 0; i < number_of_threads; ++i) {
        auto p = ptask(crafty);
        futures.push_back(move(p.get_future()));
        auto tstop = (i + 1 == number_of_threads) ? (stop) : (start + gap / number_of_threads * (i + 1));
        threads.push_back(thread(move(p), start + gap / number_of_threads * i, tstop));
    }

    vector<ull> res;

    for (auto& thread : threads) {
        thread.join();
    }

    for (auto& fut : futures) {
        auto v = fut.get();
        res.insert(res.end(), v.begin(), v.end());
    }

    cout << "Finished checking primes..." << endl;

    tend = chrono::system_clock::now();
    chrono::duration<double> elapsed_seconds = tend - tstart;

    cout << "Number of tested primes: " << ppnum(prime_counter) << endl;
    cout << "Number of found crafty primes: " << res.size() << endl;
    cout << "Crafty primes are: ";
    for (auto iter = res.begin(); iter != res.end(); ++iter) {
        if (iter != res.begin())
            cout << ", ";
        cout << *iter;
    }
    cout << endl;
    cout << "Time taken: " << elapsed_seconds.count() << endl;
}

Output:
Start: 0 * 10^0, stop: 1.000000 * 10^11
Scanning 1.000000 * 10^11 numbers
Number of threads: 4
Checking primes...
Thread scanning from 25000000000 to 50000000000
Thread scanning from 0 to 25000000000
Thread scanning from 50000000000 to 75000000000
Thread scanning from 75000000000 to 100000000000
Thread scanning from 75000000000 to 100000000000 is done.
Found 0 crafty primes.
Thread scanning from 50000000000 to 75000000000 is done.
Found 0 crafty primes.
Thread scanning from 25000000000 to 50000000000 is done.
Found 0 crafty primes.
Thread scanning from 0 to 25000000000 is done.
Found 7 crafty primes.
Finished checking primes...
Number of tested primes: 4.118055 * 10^9
Number of found crafty primes: 7
Crafty primes are: 2, 5, 3449, 6287, 7589, 9397, 93557
Time taken: 2557.22

At num=12919, right should be 120000000001000000000.  This overflows a 64-bit int, and in your program r = 9223372036854775807.  I think you're going to need to use GMP or something similar.

Very nice.  Timing on 3930K with 12 threads is 54s for 1e10 and 1e11 in 421s.

It was a good excuse to try out the concurrency C++11 features

C, with GMP, multithreaded (1e8 in 17s for 1 thread)
Similar in concept to the rest, with probably a bit of optimizations here and there.
Compile: gcc -I/usr/local/include -Ofast crafty.c -pthread -L/usr/local/lib -lgmp && ./a.out
Please donate your CPU power. I don't have a fast computer.
1e8 in 17 seconds with 1 thread on my macbook air.
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <gmp.h>
#include <pthread.h>
#include <string.h>

#define THREAD_COUNT 1           // Number of threads
#define MAX_DIGITS   32768       // Maximum digits allocated for the string... some c stuff
#define MAX_NUMBER   "100000000" // Number in string format
#define START_INDEX  1           // Must be an odd number >= 1
#define GET_WRAP_INDEX(index, stringLength) index<0?stringLength+index:index>=stringLength?index-stringLength:index

static void huntCraftyPrime(int startIndex) {

    char lCS [MAX_DIGITS];
    char rCS [MAX_DIGITS];
    char tPS [MAX_DIGITS];

    mpz_t tP, lC, rC, max;
    mpz_init_set_ui(tP, startIndex);
    mpz_init(lC);
    mpz_init(rC);
    mpz_init_set_str(max, MAX_NUMBER, 10);

    int increment = THREAD_COUNT*2;

    if (START_INDEX < 9 && startIndex == START_INDEX) {
        printf("10 10 2\n\n");
        printf("10 10 5\n\n");
    }

    while (mpz_cmp(max, tP) > 0) {
        mpz_get_str(tPS, 10, tP);
        int tPSLength = strlen(tPS);
        int l = 0, r = 0, p = 0;
        while (p < tPSLength) {
            char lD = tPS[GET_WRAP_INDEX(p-1, tPSLength)];
            char d  = tPS[GET_WRAP_INDEX(p  , tPSLength)];
            char rD = tPS[GET_WRAP_INDEX(p+1, tPSLength)];
            if (d == '0') {
                if (lD != '1') lCS[l++] = '0';
                if (rD != '1') rCS[r++] = '0';
            } else if (d == '1') {
                lCS[l++] = (lD != '1') ? '1' : '0';
                rCS[r++] = (rD != '1') ? '1' : '0';
            } else if (d == '2') {
                if (lD == '1') {
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                } else if (lD == '2') {
                    lCS[l++] = '1';
                    lCS[l++] = '0';
                } else {
                    lCS[l++] = '2';
                }
                if (rD == '1') {
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                } else if (rD == '2') {
                    rCS[r++] = '1';
                    rCS[r++] = '0';
                } else {
                    rCS[r++] = '2';
                }
            } else if (d == '3') {
                if (lD == '1') {
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                } else if (lD == '2') {
                    lCS[l++] = '1';
                    lCS[l++] = '1';
                } else if (lD == '3') {
                    lCS[l++] = '1';
                    lCS[l++] = '0';
                } else {
                    lCS[l++] = '3';
                }
                if (rD == '1') {
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                } else if (rD == '2') {
                    rCS[r++] = '1';
                    rCS[r++] = '1';
                } else if (rD == '3') {
                    rCS[r++] = '1';
                    rCS[r++] = '0';
                } else {
                    rCS[r++] = '3';
                }
            } else if (d == '4') {
                if (lD == '1') {
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                } else if (lD == '2') {
                    lCS[l++] = '1';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                } else if (lD == '3') {
                    lCS[l++] = '1';
                    lCS[l++] = '1';
                } else if (lD == '4') {
                    lCS[l++] = '1';
                    lCS[l++] = '0';
                } else {
                    lCS[l++] = '4';
                }
                if (rD == '1') {
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                } else if (rD == '2') {
                    rCS[r++] = '1';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                } else if (rD == '3') {
                    rCS[r++] = '1';
                    rCS[r++] = '1';
                } else if (rD == '4') {
                    rCS[r++] = '1';
                    rCS[r++] = '0';
                } else {
                    rCS[r++] = '4';
                }
            } else if (d == '5') {
                if (lD == '1') {
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                } else if (lD == '2') {
                    lCS[l++] = '1';
                    lCS[l++] = '0';
                    lCS[l++] = '1';
                } else if (lD == '3') {
                    lCS[l++] = '1';
                    lCS[l++] = '2';
                } else if (lD == '4') {
                    lCS[l++] = '1';
                    lCS[l++] = '1';
                } else if (lD == '5') {
                    lCS[l++] = '1';
                    lCS[l++] = '0';
                } else {
                    lCS[l++] = '5';
                }
                if (rD == '1') {
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                } else if (rD == '2') {
                    rCS[r++] = '1';
                    rCS[r++] = '0';
                    rCS[r++] = '1';
                } else if (rD == '3') {
                    rCS[r++] = '1';
                    rCS[r++] = '2';
                } else if (rD == '4') {
                    rCS[r++] = '1';
                    rCS[r++] = '1';
                } else if (rD == '5') {
                    rCS[r++] = '1';
                    rCS[r++] = '0';
                } else {
                    rCS[r++] = '5';
                }
            } else if (d == '6') {
                if (lD == '1') {
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                } else if (lD == '2') {
                    lCS[l++] = '1';
                    lCS[l++] = '1';
                    lCS[l++] = '0';
                } else if (lD == '3') {
                    lCS[l++] = '2';
                    lCS[l++] = '0';
                } else if (lD == '4') {
                    lCS[l++] = '1';
                    lCS[l++] = '2';
                } else if (lD == '5') {
                    lCS[l++] = '1';
                    lCS[l++] = '1';
                } else if (lD == '6') {
                    lCS[l++] = '1';
                    lCS[l++] = '0';
                } else {
                    lCS[l++] = '6';
                }
                if (rD == '1') {
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                } else if (rD == '2') {
                    rCS[r++] = '1';
                    rCS[r++] = '1';
                    rCS[r++] = '0';
                } else if (rD == '3') {
                    rCS[r++] = '2';
                    rCS[r++] = '0';
                } else if (rD == '4') {
                    rCS[r++] = '1';
                    rCS[r++] = '2';
                } else if (rD == '5') {
                    rCS[r++] = '1';
                    rCS[r++] = '1';
                } else if (rD == '6') {
                    rCS[r++] = '1';
                    rCS[r++] = '0';
                } else {
                    rCS[r++] = '6';
                }
            } else if (d == '7') {
                if (lD == '1') {
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                } else if (lD == '2') {
                    lCS[l++] = '1';
                    lCS[l++] = '1';
                    lCS[l++] = '1';
                } else if (lD == '3') {
                    lCS[l++] = '2';
                    lCS[l++] = '1';
                } else if (lD == '4') {
                    lCS[l++] = '1';
                    lCS[l++] = '3';
                } else if (lD == '5') {
                    lCS[l++] = '1';
                    lCS[l++] = '2';
                } else if (lD == '6') {
                    lCS[l++] = '1';
                    lCS[l++] = '1';
                } else if (lD == '7') {
                    lCS[l++] = '1';
                    lCS[l++] = '0';
                } else {
                    lCS[l++] = '7';
                }
                if (rD == '1') {
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                } else if (rD == '2') {
                    rCS[r++] = '1';
                    rCS[r++] = '1';
                    rCS[r++] = '1';
                } else if (rD == '3') {
                    rCS[r++] = '2';
                    rCS[r++] = '1';
                } else if (rD == '4') {
                    rCS[r++] = '1';
                    rCS[r++] = '3';
                } else if (rD == '5') {
                    rCS[r++] = '1';
                    rCS[r++] = '2';
                } else if (rD == '6') {
                    rCS[r++] = '1';
                    rCS[r++] = '1';
                } else if (rD == '7') {
                    rCS[r++] = '1';
                    rCS[r++] = '0';
                } else {
                    rCS[r++] = '7';
                }
            } else if (d == '8') {
                if (lD == '1') {
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                } else if (lD == '2') {
                    lCS[l++] = '1';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                } else if (lD == '3') {
                    lCS[l++] = '2';
                    lCS[l++] = '2';
                } else if (lD == '4') {
                    lCS[l++] = '2';
                    lCS[l++] = '0';
                } else if (lD == '5') {
                    lCS[l++] = '1';
                    lCS[l++] = '3';
                } else if (lD == '6') {
                    lCS[l++] = '1';
                    lCS[l++] = '2';
                } else if (lD == '7') {
                    lCS[l++] = '1';
                    lCS[l++] = '1';
                } else if (lD == '8') {
                    lCS[l++] = '1';
                    lCS[l++] = '0';
                } else {
                    lCS[l++] = '8';
                }
                if (rD == '1') {
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                } else if (rD == '2') {
                    rCS[r++] = '1';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                } else if (rD == '3') {
                    rCS[r++] = '2';
                    rCS[r++] = '2';
                } else if (rD == '4') {
                    rCS[r++] = '2';
                    rCS[r++] = '0';
                } else if (rD == '5') {
                    rCS[r++] = '1';
                    rCS[r++] = '3';
                } else if (rD == '6') {
                    rCS[r++] = '1';
                    rCS[r++] = '2';
                } else if (rD == '7') {
                    rCS[r++] = '1';
                    rCS[r++] = '1';
                } else if (rD == '8') {
                    rCS[r++] = '1';
                    rCS[r++] = '0';
                } else {
                    rCS[r++] = '8';
                }
            } else if (d == '9') {
                if (lD == '1') {
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                } else if (lD == '2') {
                    lCS[l++] = '1';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                    lCS[l++] = '1';
                } else if (lD == '3') {
                    lCS[l++] = '1';
                    lCS[l++] = '0';
                    lCS[l++] = '0';
                } else if (lD == '4') {
                    lCS[l++] = '2';
                    lCS[l++] = '1';
                } else if (lD == '5') {
                    lCS[l++] = '1';
                    lCS[l++] = '4';
                } else if (lD == '6') {
                    lCS[l++] = '1';
                    lCS[l++] = '3';
                } else if (lD == '7') {
                    lCS[l++] = '1';
                    lCS[l++] = '2';
                } else if (lD == '8') {
                    lCS[l++] = '1';
                    lCS[l++] = '1';
                } else if (lD == '9') {
                    lCS[l++] = '1';
                    lCS[l++] = '0';
                } else {
                    lCS[l++] = '9';
                }
                if (rD == '1') {
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                } else if (rD == '2') {
                    rCS[r++] = '1';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                    rCS[r++] = '1';
                } else if (rD == '3') {
                    rCS[r++] = '1';
                    rCS[r++] = '0';
                    rCS[r++] = '0';
                } else if (rD == '4') {
                    rCS[r++] = '2';
                    rCS[r++] = '1';
                } else if (rD == '5') {
                    rCS[r++] = '1';
                    rCS[r++] = '4';
                } else if (rD == '6') {
                    rCS[r++] = '1';
                    rCS[r++] = '3';
                } else if (rD == '7') {
                    rCS[r++] = '1';
                    rCS[r++] = '2';
                } else if (rD == '8') {
                    rCS[r++] = '1';
                    rCS[r++] = '1';
                } else if (rD == '9') {
                    rCS[r++] = '1';
                    rCS[r++] = '0';
                } else {
                    rCS[r++] = '9';
                }
            }
            ++p;
        }
        lCS[l] = '\0';
        rCS[r] = '\0';

        mpz_set_str(lC, lCS, 10);
        mpz_set_str(rC, rCS, 10);

        if ((mpz_divisible_p(lC, tP) && mpz_cmp(lC, tP) > 0) || (mpz_divisible_p(rC, tP) && mpz_cmp(rC, tP) > 0)){
            if (mpz_millerrabin(tP, 25)) {
                gmp_printf("%Zd %Zd %Zd\n\n", lC, rC, tP);
            }
        }
        mpz_add_ui(tP, tP, increment);
    }
}

static void *huntCraftyPrimeThread(void *p) {
    int* startIndex = (int*) p;
    huntCraftyPrime(*startIndex);
    pthread_exit(NULL);
}

int main(int argc, char *argv[]) {

    struct timeval time_started, time_now, time_diff;
    gettimeofday(&time_started, NULL);

    int  startIndexes[THREAD_COUNT];
    pthread_t threads[THREAD_COUNT];

    int startIndex = START_INDEX;
    for (int i = 0; i < THREAD_COUNT; ++i) {
        for (;startIndex % 2 == 0; ++startIndex);
        startIndexes[i] = startIndex;
        int rc = pthread_create(&threads[i], NULL, huntCraftyPrimeThread, (void*)&startIndexes[i]);
        if (rc) {
            printf("ERROR; return code from pthread_create() is %d\n", rc);
            exit(-1);
        }
        ++startIndex;
    }

    for (int i = 0; i < THREAD_COUNT; ++i) {
        void * status;
        int rc = pthread_join(threads[i], &status);
        if (rc) {
            printf("ERROR: return code from pthread_join() is %d\n", rc);
            exit(-1);
        }
    }

    gettimeofday(&time_now, NULL);
    timersub(&time_now, &time_started, &time_diff);
    printf("Time taken,%ld.%.6d s\n", time_diff.tv_sec, time_diff.tv_usec);

    pthread_exit(NULL);
    return 0;
}

Python, finds 93557 in 0.28s
Very similar to OP's code in that it also uses pyprimes. I did write this myself though xD
import pyprimes, time

d = time.clock()

def to_base(base, n):
    if base == 1:
        return '0'*n
    s = ""
    while n:
        s = str(n % base) + s
        n //= base
    return s

def crafty(n):
    digits = str(n)
    l, r = "", ""
    for i in range(len(digits)):
        t = int(digits[i])
        base = int(digits[i-1])
        l += to_base(base, t) if base else digits[i]
        base = int(digits[(i+1)%len(digits)])
        r += to_base(base, t) if base else digits[i]
    l, r = int(l) if l else 0, int(r) if r else 0
    if (l%n==0 and 2 <= l/n) or (r%n==0 and 2 <= r/n):
        print(n, l, r, time.clock()-d)

for i in pyprimes.primes_above(1):
    crafty(i)

It also prints out the time since start that it finds a number.
Output:
2 10 10 3.156656792490237e-05
5 10 10 0.0006756015452219958
3449 3111021 3104100 0.012881854420378145
6287 6210007 11021111 0.022036544076745254
7589 751311 125812 0.026288406792971432
9397 1231007 1003127 0.03185028207808106
93557 123121012 10031057 0.27897531840850603

Format is number left right time. As a comparison, OP's code finds 93557 in around 0.37.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
write an undefined behavior
Header:
this question has a very close duplicate, but the other question requires a difference between versions of the languages, instead of a difference between different implementation. this means that all answers from the almost-duplicate are invlid here. this is also my first question, so please don't be harsh.
the question:
in this challenge you will be writing code that runs differently on at least two different implementations of your language, such as jython / ironPython for python. different versions of the same implementation don't count.
your code should be runnable on all existing implementations (code that doesn't compile on one implementation or halts with an error isn't valid).
your code should be well-defined in the scope of each one of the implementations you chose (your code should always do the same thing when run on the same implementation, even on different computers/OS's etc.)
also, code isn't allowed to check the implementation directly.
this is a popularity contest so try to be creative, most upvoted answer wins.

you should specify that endianness isn't a valid difference. it would be trivial to submit a dozen examples in different low[ish] level languages that differ in output due to byte ordering.

@Sparr doesn't the requirement that the program will run the same on different computers/os's eliminate this?

oh, good point. I guess I was thinking of platform differences rather than language implementation differences.

But this question has a dramatically different scoring

This question invites a completely different kind of answers - instead of short answers, creative and surprising answers

I don't believe it's different enough, since answers could literally be copied directly from the other question.

@Geobits  actually not, because this question doesn't count different versions as different implementations

Your code should be well-defined in the scope of each one of the implementations you chose. That's not undefined behavior. The outcome of undefined behavior may depend on the version, the compiler flags, the weather condition or who won the last Super Bowl. What your looking for is called implementation-defined behavior.

@Dennis if so, what do you think i should change the title to?

Invoke implementation-defined behavior perhaps? Or It works, but not as I thought it would. I personally like Why are you doing this to me, Internet Explorer?, but that might be too specific to JavaScript...

FWIW I voted to close not as duplicate but as "Unclear what you're asking". The question of whether two implementations are "the same" for the purpose of this question seems to be about as answerable as the old "How many angels can dance on the head of a pin?"

C++
This should print 6.28319 on all compliant compilers of C++..and 3.14159 for the Visual C++ compiler.

#include <iostream>
#if compl-1
#define oddNewPi =6.28318530718,compl
#else
#define twoPlusTwoIsFive
#endif
int main(int twoPlusTwoIsFive, char **warIsPeace){
    double goodOlPi = -3.14159265359,
    bitand oddNewPi = goodOlPi;

    int J = 42;
    float k = (compl+J)/-40.0f;

    goodOlPi *= -1;
    if(k > 1.0f){
        twoPlusTwoIsFive oddNewPi *= compl-3;
    }

    std::cout << goodOlPi << std::endl;
}

How this works: compl is equivalent to the operator ~, thus, compl-1 is 0. However, for the Visual C++ compiler, compl is not treated as an operator (if you include <ciso686>, then it is a macro that expands to ~), therefore, #if compl-1 is treated as #if 0-1, or #if -1.
bitand is equivalent to &, but in the code here, the Visual C++ compiler treats it as a variable name instead.
When compl-1 evaluates as false, the code expands to
#include <iostream>
int main(int, char **warIsPeace){
    double goodOlPi = -3.14159265359,
          &oddNewPi = goodOlPi;

    int J = 42;
    // equal to 43/40.0f
    float k = (~ +J)/-40.0f;

    goodOlPi *= -1;
    if(k > 1.0f){ // always true
        oddNewPi *= ~ -3; // equal to two
    }

    // prints 6.28319
    std::cout << goodOlPi << std::endl;
}

whereas if compl-1 evaluates as true, the code expands to
#include <iostream>
int main(int twoPlusTwoIsFive, char **warIsPeace){
    double goodOlPi = -3.14159265359,
           bitand   = 6.28318530718,
           compl    = goodOlPi;

    int J = 42;
    // equal to (-3.1415.. + 42)/-40.0f: about -1
    float k = (compl + J)/-40.0f;

    goodOlPi *= -1;
    if(k > 1.0f){ // always false
        twoPlusTwoIsFive = 6.28318530718, compl *= compl - 3;
    }

    // prints 3.14159
    std::cout << goodOlPi << std::endl;
}

JavaScript (ES6)
In ES5 and possibly older versions, prefixing a number with 0x would cause the number to be treated as hexadecimal.
In ES6, prefixing a number with 0b causes the number to treated as binary.
The Number constructor attempts to evaluate the argument as a number and if it is unable to do so, returns NaN. For strings, the evaluation syntax describes a positive/negative sign with decimal digits OR 0x followed by hexadecimal digits (optionally surrounded by whitespace). The JavaScript engine in Firefox and Chrome appear to have different implementations when a string is passed beginning with 0b:
Firefox 32
Number('11'); // 11
Number('011'); // 11
Number('0b11'); // NaN
Number('0x11'); // 17

Number(11); // 11
Number(011); // 9
Number(0b11); // 3
Number(0x11); // 17

Chrome 37
Number('11'); // 11
Number('011'); // 11
Number('0b11'); // 3
Number('0x11'); // 17

Number(11); // 11
Number(011); // 9
Number(0b11); // 3
Number(0x11); // 17

I'm assuming that the Chromium dev team will fix the bug sooner or later, but these are the latest stable versions of the browsers at this point in time.
Neither Node.js nor Internet Explorer's JavaScript implementation supports this feature of ES6, so it would not be fair to test on those platforms.
I should also note that the ES6 specification is still a draft, so perhaps strings beginning with "0b" may be allowed in the evaluation syntax some time in the future.

I'd rather have the change the spec. Number('0b11') looks pretty handy.

C++
I'm not sure this is exactly what the question asked for, but this came up as a side-question in an interview once:
#include <iostream>

#define f(a, b) a * b

int main(int argc, char **argv)
{
    int i = 3;

    std::cout << f(i++, i++) << std::endl;
    std::cin.ignore();

    return 0;
}

VC++ returns the answer as 3 * 3 = 9. compileonline.com (which uses g++) returns the answer as 3 * 4 = 12 (those are all the compilers I have access to right now). I can't imagine that there's any more possible answers than those two. Try it out for yourself and see what you get!

@may i ask what part of the spec is unclear?

You didn't mention anything about using different compilers of the same language.

a compiler is an implementation

That's actual undefined behavior, so while 9 and 12 may sound like the two sensible outcomes, the compiler is allowed to do anything in this case.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Smallest python script to print even numbers 0 to 100
I'm work on a problem which I set myself for fun, which is to create a python script which prints the even numbers from 0 to 100. The challenge is to make the script as small as possible. This is what I have so far:
for x in range(0, 101):
    if (x % 2 == 0):
        print x

Currently it is 60 bytes. Can anyone think of a way to make it smaller?

Edit: print(*range(2,101,2),sep='\n') which is 30 bytes. Any smaller?

i=2;exec"print i;i+=2;"*50

bitpwner's thing has 26 bytes if anyone cares

@bitpwner Not all non-competition questions are off topic.

Ah! My bad. Thanks for the link, was trying to hunt for it.

This tip is located in the python golfing tips page http://codegolf.stackexchange.com/questions/54/tips-for-golfing-in-python/1020#1020.

Is this supposed to start at 0 or 2? I don't python much, but it looks to me like your two examples do different things. Please correct me if not.

print "0 10 100" (is binary OK?)

@squeamishossifrage don't forget to golf out the space ;)

print(*range(101),sep='\n') dang, not even my pedantic "you didn't say I couldn't print the numbers in between!" solution isn't as short as the other one :(

Cannot compete, but for completeness a recursive solution: f=lambda i:i and"%s\n%i"%(f(i-2),i);print f(100)

@Geobits raises a good point; it should be noted that 0 is even.

Python 2 - 12 characters
print 8**999

The decimal representation of all even numbers from 0 to 100 can be found in the output:
153778990270139647116444851659594064330089236967104214470764753645007350076834118596920008479824182447803706156756475613564110522612279602948135310258168541404369918794480627176627915013920083365328091029969610052054309789461709376676636344651086297099162082351332867728061686056465813162964114500668343488577962834185114919242101638217077550294093097112980059735456387540301162747936045475366317560310988720435512281742591085641505551107966844283901574058972330493685836063965131445246304097593431852972101058022587137885482726523043570690342524474585327775688980689010069001288756281975198668705741000141718184277589376710426738442847382969979234512669279398030637083755270090078676447687796406001053805898105262326290072552249025832780916090265261064205460488458795026145331708830141367124625271312584437671840499845750728447412590406684361326531266896486146862384988911439049971734022314877278748672

As a bonus, so can the odd numbers.

Only problem: It prints the odd numbers and a lot more too.

@Sieg, even and odd... kinda got all the bases covered, not sure how you find "a lot more" in that. ;)

Isn't the first time I have a different opinion than other users. I like your answer anyways.

@paqogomez even numbers 0-100, the odd numbers, and a lot more even numbers >100

Too curious to avoid asking a dumb Q, why specifically 8*999?

@0xc0de It's one of the shortest way to obtain a big number that satisfy the property requested. Other examples are 2**952, 2**964, 2**975, 3**553, 3**612 and other 1231 with the base < 10 and exponent < 1000.

@OllieFord, thank you for correcting someone that was wrong on the internet

@paqogomez Isn't that exactly what you did in the first place..? No need to be so defensive, I was just suggesting that may have been what Sieg meant.

@OllieFord No need to spoil feersum's excellent answer with a drawn out misunderstanding.  I am just having fun. (notice the :)) ;-)

Python 3, 22 (Possibly not allowed)
If the challenge is "to create a python script which prints the even numbers from 0 to 100" and not "to create a python script which prints the even numbers from 0 to 100, newline separated", then the shortest solution is:
print(*range(0,101,2))

Remember, it's very important in code golf not to put any limitations on yourself you don't have to - do what the problem asks, and no more.

Wouldn't OP's second answer in the edit make you think he wanted it newline separated?

That's entirely possibly, and is why possibly not allowed is in the title. On the other hand, it's also possible that he/she got caught up in matching the output of his initial program, and forgot the initial problem spec. Since I don't know which is the case, I gave this answer.

Python2 26
i=0;exec"print i;i+=2;"*51

independent discovery of @bitpwner's solution

I get a SyntaxError when I try to run that. Should this answer's top line say "Python 2, 26"?

+1, you appear to have been 58 seconds faster to post this solution. :)

Python 2 - 26
i=0;exec"print i;i+=2;"*51

Based on the tip on exec with string multiplication found at Tips for golfing in Python.

Should include 0, see Sparr's solution.

I get a SyntaxError when I try to run that. Should this answer's top line say "Python 2 - 26"?

Python 2, 26 (possibly not allowed)
i=102
while i:i-=2;print i

It wasn’t strictly specified, in which order the numbers were to be printed.

Python 2 - 20 (Possibly not allowed)
This is python 2 specific and probably cheating since it prints the list, but since all numbers end up on the screen:
print range(0,101,2)

Python 2, 28
for i in range(51):print 2*i

Python 2 in *NIX, 24
os.system('seq 0 2 100')

If you need to add
import os

Then the total is 33 characters.

Clever - This might well be superior in some cases. Is it OS specific?

@isaacg Very much so, as os.system calls a system program.

If that's allowed, then os.system('a'), because I happen to have a program called a with the desired behaviour on my system..

@OllieFord seq is part of gnu coreutils. You don't have quite as much clout.

Python 3, 29
*a,=map(print,range(0,101,2))

If you're in Python 2 and happen to have already imported the print function, you don't have to make the iterator object into a list and it becomes 25 characters:
map(print,range(0,101,2))

I don't know that that's entirely fair though.
Here's another fun idea that works in python 2 or 3. It's a tad longer.
def p(i):
    if i+2:p(i-2);print i
p(100)

The Python 3 version can be shortened to *a,=map(print,range(0,101,2)) using Extended Iterable Unpacking.

@flornquake Thanks, I've updated it.

Python 2 - 24
0;exec"_+=2;print _;"*50

(based on bitpwner and Sparr solution)
In the shell, "_" contains the value of the previously evaluated expression

You should note that this only works, if pasted into the interactive mode of some Python interpreters (e.g., it does not work in IPython) and not as a script.

you're right, i forgot to mention that. (btw works in the standard Python console)

-1 -- The question explicitly mentions a python script, which means the code should be written to a file and executed. Otherwise a better solution would simply be:range(0,102,2) since this would display all the even numbers (plus some commas and two brackets) on the screen.

Python 2 - 20 (questionable)
If isaacg's space-separated solution is OK, then presumably the normal list formatting is as well:
print range(0,101,2)

For further rule-twisting, apply SirBraneDamuj's suggestion from the comments:
print range(101)

and you are at 16. So what if there's some extra garbage separating them?

Python List Comprehension - 39
This uses a list comprehension, one trick to make it shorter is to multiply the index by 2 rather than going from 0 to 100 and a trailing if x % 2 check for even.
print'\n'.join(`2*x`for x in range(51))

Using a map and @isaacg's suggestion it ends up being the same 39 characters:
print'\n'.join(map(str,range(0,101,2)))

Edit: After separating values by newline it is by far not the shortest.

This doesn't answer the question - OP says prints the even numbers from 0 to 100, not just generate them. Also, if you just want the list, range(0,101,2) is shorter.

@isaacg Updated to answer the question, now much longer, needing to embed each value in str() for the join kills it.

@Wrzlprmft Thanks for the suggestion, didn't know I could do that! Code changed to reflect this new knowledge.

In my case, I use list comprehension (in Python 3.9). < Sorry, I came late but I hope it makes sense.>
even_numbers = [x for x in range(100) if x % 2 == 0]
print(even_numbers)

Welcome to Code Golf! This site is for competitive programming, so we require answers to make a serious attempt at golfing. Make sure to read our tips questions if you want some hints!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/