[Question]
  [
**Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers.
 
 
---
 This question does not appear to be about code golf or coding challenges within the scope defined in the [help center](https://codegolf.stackexchange.com/help/on-topic).
Closed 7 years ago.
**Locked**. This question and its answers are [locked](/help/locked-posts) because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
 
 
You are to write a program that does one of the following.
1. Only displays "Hello World" does nothing else
2. Quits and nothing else (no output, no errors.)
3. Takes one line of input, parses it as an integer, displays the first that many primes (or gives a nice error if it is given input that can't be parsed as an integer, or is less than 0.)
4. Given one line of input, it parses it has a stock symbol, and checks online for the current stock value and its change.
The catch, it should not be apparent which function it performs. Namely, for someone looking at your code, it should not be apparent which function it will do. Also, it may only perform and be able to perform one function (it can not pick and choose.) How good a program is is determined by how uncertain someone is that looks at it as to what its function is, and also how familiar that person is with that language.
BONUS:
If you in a clever way make it so although for any one compiler/intrpreter and platform, the program will also perform the same function, different compilers/interpreters or platforms, it will perform a different function. This bonus may only be collected if done cleverly.
BONUS:
If your program only contains code that is capable of one function (save nothing, as empty code is capable of that), and it is not possible to make a simple modification unrelated to the function to allow it to perform a different function.
For example: if you did
```
obfuscatedBool = 1g8uhad'l8fygrcetdu8y4fd/,.oe87fy4d --Magic
if obfuscatedBool: print "Hello World"
```
Would not count as obfuscatedBool could be made True or False to make it print "Hello World" or do nothing respectively.
INFINITY BONUS: If you realize both bonuses simultaneously, you are magic.
NEGATIVE BONUS: Using libraries with specific abilities to do the functions.
Voters, take the bonuses in to consideration, because the program with the most votes wins!
Note: If you say what your program does, make sure to use spoiler syntax!
  
[Answer]
# Whitespace/Brainfuck/Python
```
'''begin''''''''''''  
main(args){   	  	   
	parseArgs=args.Find('^++++++++^[<++++[<++<+++<+++<+>>>>a-z]<+<+<A-Z[>]>0-9]<<.<---.*$');
    for(int i=0;	Range(GetLength(parseArgs));	i++){validateArg(parseArgs(i));}  	 	
	//name
    string stockName="";		 		  
	//loop
    for(int i=0;Range(GetLength(parseArgs));i++){		 		  
	//validate
     	if(matchFound=Find('a+z+A+.Z.0+9+_+.<<*$'){	 				
	//found
     	parseArgs(i).Split('>-.>.+');}     
	
     	for(int j=0;Range(GetLength(parseArgs(i)));j++){	 			
	//download
    data=ConvertTo.String(eval("curl -get	http://some-stock-ticker-source-url-here.com"));	 				
	print;
    print data;			  	 
	
    //line separator		 		  
	
    print "--------.";		  	  
	}}
}  
''finish'''''''''''''''
```
[Wikipedia: Whitespace (programming language)](http://en.wikipedia.org/wiki/Whitespace_(programming_language))  
[Online Whitespace Interpreter to Test Answer](http://whitespace.kauaveel.ee/)  
[Online Brainfuck Interpreter to Test Answer](http://esoteric.sange.fi/brainfuck/impl/interp/i.html)
> 
>  Output (Whitespace/Brainfuck):
>  
> ```
> Hello World
> ```
> 
>  
>  Ouput (Python):  
> 
>  Nothing, but runs successfully.
> 
> 
> 
[Answer]
**JS**
```
ﾟωﾟﾉ=/｀ｍ´）ﾉ~┻━┻//*´∇｀*/['_'];o=(ﾟｰﾟ)=_=3;c=(ﾟΘﾟ)=(ﾟｰﾟ)-(ﾟｰﾟ);(ﾟДﾟ)=(ﾟΘﾟ)=(o^_^o)/(o^_^o);(ﾟДﾟ)={ﾟΘﾟ:'_',ﾟωﾟﾉ:((ﾟωﾟﾉ==3)+'_')[ﾟΘﾟ],ﾟｰﾟﾉ:(ﾟωﾟﾉ+'_')[o^_^o-(ﾟΘﾟ)],ﾟДﾟﾉ:((ﾟｰﾟ==3)+'_')[ﾟｰﾟ]};(ﾟДﾟ)[ﾟΘﾟ]=((ﾟωﾟﾉ==3)+'_')[c^_^o];(ﾟДﾟ)['c']=((ﾟДﾟ)+'_')[(ﾟｰﾟ)+(ﾟｰﾟ)-(ﾟΘﾟ)];(ﾟДﾟ)['o']=((ﾟДﾟ)+'_')[ﾟΘﾟ];(ﾟoﾟ)=(ﾟДﾟ)['c']+(ﾟДﾟ)['o']+(ﾟωﾟﾉ+'_')[ﾟΘﾟ]+((ﾟωﾟﾉ==3)+'_')[ﾟｰﾟ]+((ﾟДﾟ)+'_')[(ﾟｰﾟ)+(ﾟｰﾟ)]+((ﾟｰﾟ==3)+'_')[ﾟΘﾟ]+((ﾟｰﾟ==3)+'_')[(ﾟｰﾟ)-(ﾟΘﾟ)]+(ﾟДﾟ)['c']+((ﾟДﾟ)+'_')[(ﾟｰﾟ)+(ﾟｰﾟ)]+(ﾟДﾟ)['o']+((ﾟｰﾟ==3)+'_')[ﾟΘﾟ];(ﾟДﾟ)['_']=(o^_^o)[ﾟoﾟ][ﾟoﾟ];(ﾟεﾟ)=((ﾟｰﾟ==3)+'_')[ﾟΘﾟ]+(ﾟДﾟ).ﾟДﾟﾉ+((ﾟДﾟ)+'_')[(ﾟｰﾟ)+(ﾟｰﾟ)]+((ﾟｰﾟ==3)+'_')[o^_^o-ﾟΘﾟ]+((ﾟｰﾟ==3)+'_')[ﾟΘﾟ]+(ﾟωﾟﾉ+'_')[ﾟΘﾟ];(ﾟｰﾟ)+=(ﾟΘﾟ);(ﾟДﾟ)[ﾟεﾟ]='\\';(ﾟДﾟ).ﾟΘﾟﾉ=(ﾟДﾟ+ﾟｰﾟ)[o^_^o-(ﾟΘﾟ)];(oﾟｰﾟo)=(ﾟωﾟﾉ+'_')[c^_^o];(ﾟДﾟ)[ﾟoﾟ]='\"';(ﾟДﾟ)['_']((ﾟДﾟ)['_'](ﾟεﾟ+(ﾟДﾟ)[ﾟoﾟ]+(ﾟДﾟ)[ﾟεﾟ]+(ﾟΘﾟ)+(ﾟｰﾟ)+(ﾟΘﾟ)+(ﾟДﾟ)[ﾟεﾟ]+(ﾟΘﾟ)+((ﾟｰﾟ)+(ﾟΘﾟ))+(ﾟｰﾟ)+(ﾟДﾟ)[ﾟεﾟ]+(ﾟΘﾟ)+(ﾟｰﾟ)+((ﾟｰﾟ)+(ﾟΘﾟ))+(ﾟДﾟ)[ﾟεﾟ]+(ﾟΘﾟ)+((o^_^o)+(o^_^o))+((o^_^o)-(ﾟΘﾟ))+(ﾟДﾟ)[ﾟεﾟ]+(ﾟΘﾟ)+((o^_^o)+(o^_^o))+(ﾟｰﾟ)+(ﾟДﾟ)[ﾟεﾟ]+((ﾟｰﾟ)+(ﾟΘﾟ))+(c^_^o)+(ﾟДﾟ)[ﾟεﾟ]+(ﾟｰﾟ)+((o^_^o)-(ﾟΘﾟ))+(ﾟДﾟ)[ﾟεﾟ]+(ﾟΘﾟ)+(ﾟΘﾟ)+(c^_^o)+(ﾟДﾟ)[ﾟεﾟ]+(ﾟΘﾟ)+(ﾟｰﾟ)+((ﾟｰﾟ)+(ﾟΘﾟ))+(ﾟДﾟ)[ﾟεﾟ]+(ﾟΘﾟ)+((ﾟｰﾟ)+(ﾟΘﾟ))+(ﾟｰﾟ)+(ﾟДﾟ)[ﾟεﾟ]+(ﾟΘﾟ)+((ﾟｰﾟ)+(ﾟΘﾟ))+(ﾟｰﾟ)+(ﾟДﾟ)[ﾟεﾟ]+(ﾟΘﾟ)+((ﾟｰﾟ)+(ﾟΘﾟ))+((ﾟｰﾟ)+(o^_^o))+(ﾟДﾟ)[ﾟεﾟ]+(ﾟｰﾟ)+(c^_^o)+(ﾟДﾟ)[ﾟεﾟ]+(ﾟΘﾟ)+((o^_^o)-(ﾟΘﾟ))+((ﾟｰﾟ)+(o^_^o))+(ﾟДﾟ)[ﾟεﾟ]+(ﾟΘﾟ)+((ﾟｰﾟ)+(ﾟΘﾟ))+((ﾟｰﾟ)+(o^_^o))+(ﾟДﾟ)[ﾟεﾟ]+(ﾟΘﾟ)+((o^_^o)+(o^_^o))+((o^_^o)-(ﾟΘﾟ))+(ﾟДﾟ)[ﾟεﾟ]+(ﾟΘﾟ)+((ﾟｰﾟ)+(ﾟΘﾟ))+(ﾟｰﾟ)+(ﾟДﾟ)[ﾟεﾟ]+(ﾟΘﾟ)+(ﾟｰﾟ)+(ﾟｰﾟ)+(ﾟДﾟ)[ﾟεﾟ]+(ﾟｰﾟ)+((o^_^o)-(ﾟΘﾟ))+(ﾟДﾟ)[ﾟεﾟ]+((ﾟｰﾟ)+(ﾟΘﾟ))+(ﾟΘﾟ)+(ﾟДﾟ)[ﾟoﾟ])(ﾟΘﾟ))('_');
```
> 
>  Alerts "Hello World"
>   
> 
>  Was answered at <https://codegolf.stackexchange.com/a/3946/803>   
> 
>  Since I did not come up with this answer, making it a community wiki
> 
> 
> 
[Answer]
## MS-DOS x86 Assembly
Because it isn't already obfuscated when it's in assembly, let's make it even worse! This SHOULD work with any assembler that can assemble to a COM file, but I've only tested with TASM for DOS using `tasm obfuse`, `tlink /t obfuse`
```
.286
CODE SEGMENT
ASSUME CS:code, DS:code
ORG 0100h
start:
.586
xor eax, eax
xor ecx, ecx
xor edx, edx
xor ebx, ebx
xor edi, edi
xor esi, esi
stc
pushfd
rcr di, 8
mov cx, 35
cli
push edi
xor word ptr [di + 8], 2720
pushfd
sub bx, 64512
rcr ebx, 11
sub word ptr [di + 125], 61702
pop eax
dec dx
and word ptr [di + 4], cx
mov ecx, eax
sub byte ptr [di + 124], 21
xor eax, ebx
push eax
xor byte ptr [di + 127], 240
popfd
xor dword ptr [di], 179066414
pushfd
xor byte ptr [di + 11], dl
pop eax
mov bp, 8268
xor byte ptr [di + 123], 110
pop edx
add byte ptr [di + 10], 49
popfd
sti
and ecx, ebx
or word ptr [di + 4], bp
and eax, ebx
xor word ptr [di + 6], 23601
cmp eax, ecx
db 'u', 5
dec cl
movsx dx, cl
int 32
CODE ENDS
END start
```
> 
>  This is self-modifying code that does several things:  
> 
>  1) It modifies the first 12 bytes to 'Hello World[dollar sign]'  
> 
>  2) It modifies the seemingly out of place 'dec cl' and 'movsx dx cl' to 'nop', 'mov ah, 9', 'int 021h'  
> 
>  3) Everything is highly interspersed within each other. This is also doing a flags test to see if your CPU supports CPUID  
> 
> 
> 
> 
[Answer]
## C
```
int puts(const char *s) {
  char error[] = "Error: invalid number\n";
  int a, b=0, c=0, i, j;
  scanf("%d", &b);
  if (b<1) {
     printf(error);
  }
  for (i=2; c<b; i++) {
     int z=1;
     for (j=2; j<i; j++) {
        z = z&&(i%j);
     }
     if (z) {
        printf("%d\n", i);
        c++;
     }
  }
}
int main () {
  printf("Hello World\n");
}
```
> 
>  On `gcc`, with default settings, this does the prime thing. Using `tcc`, you get `Hello World`. A C compiler *may* rewrite a `printf("String\n")` call into a `puts("String")` call. This is more efficient, but it does assume nobody wrote their own `puts`. A compiler does not *have* to do this, so depending on your compiler and your compiler settings, you will get either `Hello World` or a bunch of primes. The `printf` calls in `puts` are not affected, because they don't match the exact template. I think I qualify for the bonus.
> 
> 
> 
[Answer]
# LOLCODE
This language is already obfuscated by itself. Here is my code:
```
HAI
I HAS A CATURDAY
CATURDAY IS NOW A TROOF
I HAS A LOLZ ITZ 32907
I HAS A CHEEZBURGER 
MAEK CHEEZBURGER A NUMBR
CHEEZBURGER R QUOSHUNT OF LOLZ AN  LOLZ
CHEEZBURGER BIGGR THAN 1?, O RLY?
YA RLY BTW RLY LOLZ
CATURDAY R WIN 
OBTW EVERYDAY IS CATURDAY 
ME LIKEZ CATURDAY!!1!
TLDR
CHEEZBURGER R QUOSHUNT OF LOLZ AN CHEEZBURGER
NO WAI
CATURDAY R FAIL BTW LOLZ!!1!
I HAS A LIMIT ITZ 10
CHEEZBURGER R 0
OIC 
IM IN YR LOOP
CHEEZBURGER, WTF?
OMG 1
VISIBLE "Hello World!" 
OMGWTF
CATURDAY R FAIL
OIC
GTFO
IM OUTTA YR LOOP
KTHXBYE
```
> 
>  This code quits and does nothing else (no output, no errors). But although it does absolutely nothing, it runs like a charm (tested with version that contained a `VISIBLE "test"` statement before the last statement `KTHXBYE`, proving that all is fine). Basically it declares variables, changes their types, enters in loops and ifs and cases constructs, even has a line that would print "Hello World!" if ever reached (if only reached...). A total waste of computation :)
> 
> 
> 
[Answer]
# JavaScript (ES6)
Using pragma `black magic` to reveal JavaScript true power:
```
var WKRBD='';
var DIJqZ=(gFJLA=WKRBD,i=29)=>(
  "use black magic", 
  gFJLA=WKRBD.concat(gFJLA),
  [String.fromCharCode((c.charCodeAt()-61)^gFJLA[i++].charCodeAt())for(c of gFJLA.substr(1,11))].join('')
);
DIJqZ(DIJqZ);
```
**Output:**
```
Hello World
```
**Explanations:**
This program is actually quite simple and could be summarize as bellow.  
Everything else if syntactic sugar!
```
var dummy = function() {
  var output = '';
  var a = 'gFJLA=WKRBD';
  var b = 'black magic';
  for (var i = 0; i < a.length; i++) {
    output += String.fromCharCode((a[i].charCodeAt(0) - 61) ^ b[i].charCodeAt(0));
  }
  return output;
};
dummy();
```
Here is the annotated version:
```
// Nothing special here.
var WKRBD='';
// Define a new function. Its name doesn't matter.
// But its arguments do!
//   * gFJLA=WKRBD: encoded "Hello World"
//   * i=29: number of characters before "black magic"
var DIJqZ=(gFJLA=WKRBD,i=29)=>(
  // Store the XOR key using a fancy pragma name!
  "use black magic", 
  // Convert gFJLA to String thus it is possible to read 
  // its body and extract the encoded "Hello World".
  gFJLA=WKRBD.concat(gFJLA),
  // Use a generator to decode the message.
  [
    // Generate the decoded character
    String.fromCharCode(
      // Decode the character.
      // gFJLA[i++] retrieves a character from "black magic".
      (c.charCodeAt() - 61) ^ gFJLA[i++].charCodeAt()
    )
    // Iterates over the function body.
    // The extracted part is "gFJLA=WKRBD".
    for(c of gFJLA.substr(1,11))
  // Build the message. Since it is the last expression of 
  // the arrow function, its result is returned.
  ].join('')
);
// Invoke the function and pass itself as the first argument.
DIJqZ(DIJqZ);
```
[Answer]
COBOL (IBM Enterprise COBOL)
```
   ID
```
If shown that, very close to 100% of IBM Mainframe COBOL programmers would say "that's not even a program, that won't compile!". The more experience they have, the less likely they are to think it will compile (as older Mainframe COBOLs were much more strict).
Then ask "if it does compile, what does it do?" They would say, "it won't compile, but if it did, it would give some sort of error, probably Language Environment would give a U4038 or something like that".
Managed to shorten it. There are four DIVISIONs in a COBOL program. IDENTIFICATION/ID, ENVIRONMENT, DATA, PROCEDURE. It turns out that PROCEDURE *requires* the word DIVISION and the others don't. Guess which one I removed first and assumed that the other words DIVISION were mandatory... further puzzling revealed otherwise. Pity it's not Golf. A two-character COBOL program...
> 
>  OK, yes, the compiler does moan, and indeed gives it a Return Code of
>  eight. Usually people don't even generate the object code for, let
>  alone try to execute, programs with a Return Code of eight. 
>  
>  However, this is a case where none of the E-level errors affect the
>  code generated. So the code runs without a problem at all, if you generate it.  
> 
>  
>  The above source is effectively the equivalent of this:  
> 
>  
>  ID DIVISION.  
> 
>  PROCEDURE DIVISION.  
> 
>  GOBACK  
> 
>  .  
> 
> 
>  Which simply returns to whence it came.
> 
> 
> 
[Answer]
# Java,C++-11 1 Bonus claimed
Not sure about if i got both bonuses but it was already a headache to intermingle 2 programming languages...
```
/* *??/
/
#include <iostream>
using namespace std;
int main() {
    return 0;
}
/* *\u002F
class D_arvit{static int a=0,b=a++,e=a++,f=a/a;static char p(String s){return(char)Byte.parseByte(s,a);}public static void main(String[]z){//\u000Along x=e,y=b;String c=((Long)x).toString(),d=((Long)y).toString();char u=p(c+c+d+c+c+d+d),m=p(c+c+d+d+c+d+c),o=(char)(u+a+f);char _=p(c+d+d+d+d+d),$=_++;System.out.print(new char[]{p(c+d+d+c+d+d+d),m,u,u,o,$,p(c+d+c+d+c+c+c),o,(char)(o+a+f),u,(char)(m-f),_});\u000A}}
/\u002A*/
```
> 
>  Getting the C++ inbetween the java code which i already used on another Hello World answer was a Pain in the ass. Took me a while to find a fitting second language where i was able to juggle around comments as needed so they disable/enable differently at different languages
> 
> 
> 
[Answer]
# Python - 1 Bonus Claimed
```
import base64
try:
    a=1/(1/2)
    eval(compile(base64.b64decode("IyBUaGlzIGlzIGEgc2FtcGxlIFB5dGhvbiBzY3JpcHQKcHJpbnQgIkhlbGxvIiwKcHJpbnQgIldvcmxkISIK"),'<string>','exec'))
except:
    pass
```
In Python 2, `1` divided by `2` equals `0`. `1` divided by `0` can't be evaluated and throws a division by zero error. Nothing is printed, and still the program terminates without error.
In Python 3, `1/2` => `0.5`, and `1/0.5` => `2.0`. No error. `Hello, World!` is printed.
[Answer]
### Batch
```
@echo off&setLocal enableDelayedExpansion&for /L %%a in (2,1,%1)do (set/aa=%%a-1&set c=&for /L %%b in (2,1,!a!)do (set/ab=%%a%%%%b&if !b!==0 set c=1)
if !c! NEQ 1 set l=!l!%%a,)
echo !l:~0,-1!
```
> 
>  This will return a list of prime numbers less than the inputted value.  
> 
>  H:\uprof>obf.bat 12  
> 
>  2,3,5,7,11
> 
> 
> 
I don't know that convoluted counts as obfuscated, though there are definitely some aspects of obfuscation present.
[Answer]
# Ruby - or is it Whitespace?
Well, can anyone guess what I do? ~~Small hint: if you want to run it, please copy **all of the code** in the code box ;)~~ 
Update: Copying the code doesn't seem to work due to Unicode-related problems? Forking the online version and then copying the code seems to work! Look out for the whitespace ;)
[Online version](http://ideone.com/NnrbJK)
```
# encoding: utf-8
def method_missing(m, *a)
  $* << (m.to_s.size-1).to_s
end
at_exit do
  eval ($**'').scan(/.../).map(&:to_i).pack('C*')
end
                                                                                                                                                                                                                                                   
```
### Output:
```
Hello world!
```
### Explanation:
* The last line consists of quite a few chunks of no-break-spaces (UTF-8: 160dec) separated by regular spaces.
* Ruby handles the chunks as though they were methods - since no such methods are defined, `method_missing` is called, which saves the lengths of the chunks
* Each chunk represents one digit of a three digit number, which represents a character
* in `at_exit` the characters are formed by concatenating the digits etc. and the expression is evaluated, in this case `puts 'Hello world!'`
* Instead of using UTF-8 whitespaces, you could also use underscores for better visibility:
```
def method_missing(m, *a)
  $* << (m.to_s.size-1).to_s
end
at_exit do
  eval ($**'').scan(/.../).map(&:to_i).pack('C*')
end
__________ ____ _ ____ ____ _ _ _ __ _________ _ __ _____ __ __ __ __ __ __________ __ __ ___ ____ _ __ __ __ _________ _ __ _________ _ __ __ _ __ ___ ________ _ __________ ____ _ ___ ____ _ ______ __ __ _______ __ __ ________ __ __ ___ __ __
```
[Answer]
# Forth
Let's create a new TASK.
```
FORTH ok
: TASK
  [ HEX ] 3A91224B. 1F836AFE.  
  4A BASE ! D. D.     
;
TASK Hello World ok
```
> 
>  It displays two 32-bits numbers in base 74 (4Ah). 
>  74 because it is the difference between ASCII "z" and ASCII "0" plus one, so I can use it to display a small words starting from a number. 
>  The first number is "Hello" (1F836AFEh) and the second number is "World" (3A91224Bh). 
>  It really prints a trailing space after the number "World". 
> 
> 
> 
![Real execution](https://i.stack.imgur.com/ClQhx.jpg)
[Answer]
# PHP:
~~$words=array('Heart','eagle','low','lonely','over',' SPACE ','Window','optimus','rotting','list','done','!done');~~
```
$words=array('Hated','ever','lonely','lover','oposed',' to','Witness','our','rare','long','discover');
$find='l';
foreach($words as $word)echo($find^(($find&$word)^($find|$word)));
```
> 
>  Prints 'Hello World'.  
> 
>  It takes off the 1st letter from each word in the array.  
> 
>  The var `$find` can have any single-byte string of 1 byte.  
> 
>  Using a longer value for the var `$find` will give weird outputs.  
> 
> 
> 
> 
[Answer]
# Brainfuck
```
print("Hello World")
```
### Explanation
> 
>  At least if your compiler ignores invalid instructions, this program does nothing.
> 
> 
> 
[Answer]
# C++11
I claim the bonus for compiler dependence - for example, this will exhibit different beahviour between gcc 4.8 and gcc 4.9.
```
#include <iostream>
#include <list>
#include <type_traits>
#include <utility>
// Type-agnostic & efficient output
template <class T>
void write(T data)
{
    std::cout.write((char*)&data, sizeof data);
}
// Helper for automatic output to simplify exception handling
struct PrimeList : std::list<unsigned int>
{
    ~PrimeList()
    {
        while (!empty())
        {
            write(front());
            pop_front();
        }
    }
};
// Basic brute-force handler
struct BasicHandler
{
    template <class C>
    static void handle(C &primes)
    {
        std::cin.clear(std::ios_base::failbit); // remove possible non-fatal errors
        std::cin.exceptions(std::ios_base::failbit); // easier error handling
        unsigned int count;  // unsigned so that negatives error out immediately
        std::cin >> count;
        unsigned long long candidate = 1;
        for (unsigned int p = 0; p < count; ++p)
        {
            bool isPrime;
            do {
                ++candidate;
                isPrime = true;
                for (auto prime : primes)
                {
                    if (candidate % prime == 0)
                    {
                        isPrime = false;
                        break;
                    }
                }
            } while (!isPrime);
            primes.push_back(candidate);
        }
    }
};
// Smart handler using known accelerating divisors
struct SmartHandler : BasicHandler
{
    template <class C>
    static void handle(C &primes)
    {
        // Pre-fill with accelerating divisors
        primes.push_back(1819043144u);
        primes.push_back(1867980911u);
        primes.push_back(560229490u);
        BasicHandler::handle(primes);
        // Remove divisors, as they are not primes
        primes.pop_front();
        primes.pop_front();
        primes.pop_front();
    }
};
// Choose handler appropriate for container
template <class Container>
struct PrimeHandler
{
    template <class PrimePointer>
    static char selector(PrimePointer p, decltype(Container().insert(p, *p)));
    static double selector(...);
    typedef typename std::conditional<
        sizeof selector(
            typename Container::const_iterator(), typename Container::iterator()
        ) == 1
        , SmartHandler, BasicHandler
    >::type Selection;
};
int main()
{
    try {
        PrimeList primes;
        PrimeHandler<decltype(primes)>::Selection::handle(primes);
    }
    catch (std::ios_base::failure &)
    {
        std::cout.clear(std::ios_base::failbit); // remove possible non-fatal errors
        std::cout << "You need to enter a positive number" << std::endl;
    }
}
```
Compiler dependency explanation:
> 
>  C++11 changed the requirements for insert() and erase() functions in standard containers so that they now accept constant iterators, where previously they required mutable iterators. That's what PrimeHandler tests. gcc only changed its standard library to be compliant in 4.9; MSVC 2013 is not compliant yet; I don't know about clang.
> 
> 
> 
General behaviour explanation:
> 
>  The clear(x) function of streams does not *clear* flag **x**, it **sets** it. Therefore, the handle() function actually puts the stream in error state, so any attempt to read fails (and helpfully throws an exception). In the same way, the error output is avoided.  
>  The auto-output destructor of PrimeList makes sure any data in it is written - as binary, not as numbers. Of course, the "smart divisors" are actually "Hello World!" encoded in little-endian ASCII. And because an exception is thrown, nothing gets added in BasicHandler, and only the "smart divisors" are added in SmartHandler (and never removed, because of said exception).
> 
> 
> 
[Answer]
# Delphi
Not sure if this counts but I will tell you how I saw this challenge.  
My thought was to write code that wouldnt execute what you expected it to.
```
program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
uses
  System.sysutils,Generics.Collections;
type
  TMyIntList= TList<integer>;
  function SieveOfEratosthenes(upperLimit:integer):TMyIntList;overload;
  var
    i,j: integer;
    a:array of boolean;
    upperSqrt,sieveBound:integer;
  begin
    Result:=TMyIntList.Create;
    sieveBound:=Round((upperLimit-1)/2);
    upperSqrt:=Round((Sqrt(upperLimit)-1)/2);
    SetLength(a,sieveBound);
    for I:=0to sieveBound-1 do
      a[I]:=true;
    for I:=1to upperSqrt do
    begin
      if a[I] then
      begin
        J:=i*2*(i+1);
        while J<=sieveBound do
        begin
          a[J]:=false;
          J:=J+2*i+1;
        end
      end
    end;//end for loop
    Result.Add(2);
    for I:=1to sieveBound-1do
      if a[i]then
        Result.Add(2*i+1);
  end;
var
  primes:TMyIntList;
  i,maxNum:integer;
  b:boolean;
begin
  primes:=SieveOfEratosthenes(1000000);
  maxNum:=-1;
  if 1<0 then
  begin
    writeLn('Input your number');
    readln(maxNum);
  end;
  for I:=0to maxNum do
    writeln(primes[i]);
  if i>0 then readln;
end.
```
> 
>  What I did was write a program that implies to execute function 3 but actually runs function 2 and simply exits as soon as its started.  
> 
>  The hints are: **SieveOfEratosthenes** Algorithm for generating primes  
> 
>  Var **primes** and **maxNum**  
> 
>  code: `WriteLn('Input your number');readln(maxNum);`  
> 
>  Which is code that will never be reached since booleans are `False` by default
> 
> 
> 
[Answer]
# Haskell
```
import Control.Concurrent
import System.Exit
import System.Time
import Control.Monad
hw = putStrLn "Hello World" 
busyWait = do
    (TOD s p) <- getClockTime 
    go (TOD (succ s) p) 
    exitWith ExitSuccess
    where
        go t = do 
            t' <- getClockTime
            unless (t' > t) (go t)
main :: IO ()
main = forkIO hw >> busyWait
```
> 
>  Run with GHC and it will print hello World. With Hugs (which implements
>  cooperative multitasking) It will always quit without printing anything.
> 
> 
> 
[Answer]
JS
```
[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+([][[]]+[])[+[]]+([][[]]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(+(!+[]+!+[]+[+!+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[+!+[]])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]])()([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(+(!+[]+!+[]+[+!+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[+!+[]])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]])()(([]+[])[([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()[+[]])[+[]]+[!+[]+!+[]+!+[]]+(+(+!+[]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+[+[]])))()
```
> 
>  Does nothing. No Error. No Output
> 
> 
> 
[Answer]
# Matlab
Here is code that can roughly perform various operations, can you predict the flow?
```
six=input('input your number or ticker?','s')
six=six(six==6) 
if six
    'Hello World!'
elseif ~six
    try
    primes(str2num(six))
    catch
        urlread(['http://finance.yahoo.com/q?s=' six])
    end        
end
```
Here is a hint:
> 
> Regardless of which number or ticker you input, you will always end up on the same spot
> 
> 
> 
[Answer]
This one does both bonuses. Have a look at the spoilers in the end to see what it does.
**Java / Brainf\*ck**
```
//[
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
//]
public class Something {
    private static String magicNumber="1000";
    public static void primes(int nr) {
        int ct = 0;
        int val = 1+2+3+4+5+6+7+8+9+10+1+2-57;
        int primes[
                /*(*|*>) (+|+) (+|+) (+|+) (+|*>) (+|+) (+|+) (+|+) (+|+) (+|+>
                (+|+) (+|*> (+|*) <*|*< <*|*< (-|*)
                SMILEY STAMPEDE!
                */
                ]; //I probably won't use that array anyways... Whatever.
        while (nr > ct) {
            val++;
            boolean isPrime = true;
            for (int i = 2; System.out!=null && val > i; i+=1) {
                if (val % i == Integer.parseInt("0")) {
                    isPrime = false;
                    break;
                }
            }
            if (isPrime) {
                println(val);
                ct++;//>*|*> (*|*>
            }
        }
    }
    public static void main(String[] args) throws IOException {//<*|*< <*|*) I like smileys!
        new Something();
        setMagicNumber(1+(getMagicNumber()+7+9+12+4));
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String input = br.readLine();
        try {
            setMagicNumber(getMagicNumber()+3+1+2);
            System.gc();
            setMagicNumber(getMagicNumber()>5 ?getMagicNumber() : getMagicNumber()+1+2);
            magicNumber = input;
            primes(getMagicNumber());
        } catch (Exception ex) {
            magicNumber = "1000";
            println(getStockValueString(input));
        }
    }
    public static String getStockValueString(String stockname) throws IOException {
        URL url = new URL("http://marketwatch.com/investing/stock/"+stockname);
        setMagicNumber(getMagicNumber2()<7 ? (getMagicNumber2()<9+3) ? 5+3+5+7+6+3 : 2+9+6+9 : 7+6+1+2+5+2+4);
        HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
        boolean setOutput = getMagicNumber2()>2;
        httpConnection.setDoOutput(setOutput);
        setMagicNumber(getMagicNumber2()+2+3+4);
        DataOutputStream wr = new DataOutputStream(httpConnection.getOutputStream());
        setMagicNumber(getMagicNumber2()-1-2-3-4-5-6);
        wr.flush();
        setMagicNumber(getMagicNumber2()-5-3-1-8-9-5-5-4);
        BufferedReader in = new BufferedReader(new InputStreamReader(httpConnection.getInputStream()));
        String line;
        while ((line = readLine(in)) == null == (getMagicNumber2()>100000)) {
            line = line.trim();
            setContainsTxt(line);
            if (contains("p "+"class"+"=\"data "+"bgLast\"")) {
                setSubstringTxt(line);
                setIndexOfTxt(line);
                line = substringL(indexOf("p class=\"data bgLast\"")+22);
                setIndexOfTxt(line);
                setSubstringTxt(line);
                line = substringR(indexOf("/p")-1);
                return line;
            }
        }
        return "";
    }
    //>*|*> [*|*>
    public Something() {
    }
    public static int getMagicNumber2() {
        try {
            return Integer.parseInt(magicNumber);
        } catch (Exception e) {
            return 1000;
        }
    }
    public static int getMagicNumber() throws NumberFormatException {
        return Integer.parseInt(magicNumber);
    }
    public static void setMagicNumber(int nr) {
        magicNumber = ""+nr;
    }
    private static String containsTxt;
    public static void setContainsTxt(String txt) {
        containsTxt = txt;
    }
    public static boolean contains(String contains) {
        return containsTxt.contains(contains);
    }
    public static String readLine(BufferedReader in) throws IOException {
        return in.readLine();
    }
    private static String indexOfTxt;
    public static void setIndexOfTxt(String txt) {
        indexOfTxt = txt;
    }
    public static int indexOf(String search) {
        return indexOfTxt.indexOf(search);
    }
    public static void println(Object txt) {
        System.out.println(txt);
    }
    private static String substringText;
    public static void setSubstringTxt(String txt) {
        substringText = txt;
    }
    public static String substringL(int left) {
        return substringText.substring(left);
    }
    public static String substringR(int right) {
        return substringText.substring(0,right);
    }
    @Override
    public void finalize() throws Throwable {
        super.finalize();
        magicNumber = "NaN";
    }//<*|*]
}
```
**Brainfuck**
> 
>  In Brainfuck this just returns "Hello World".
> 
> 
> 
**Java**
> 
>  In Java this either returns the first x prime numbers (depending on the input number) or the stock value of the given stock market symbol (e.g. GOOG for Google). Which one is chosen depends on the implementation of the currently used JavaVM, but with the Oracle JavaVM it should get the stock market value. You can also force the prime number calculator (2nd bonus) by commenting out the System.gc()-line, which in turn stops the finalize() call so the magicNumber never becomes NaN and thus no exception is thrown that would cause the stock market value getter to run instead of the prime numbers generator.
> 
> 
> 
[Answer]
## C, 346 chars
```
#include <stdio.h>
int main(int O, char **o)
{
  int l4, l0, l, I, lO[]= { 444,131131,13031,12721,17871,20202,1111,
                            20102,18781,666,85558,66066,2222,0 };
  for(l4=0;l4<14;++l4){
    for((l=l0=lO[l4])&&(l0=-7);
         l>4&&(I=2-((l|l>>O)&O));l=l&O?l+(l<<O)+O:l>>I,l0+=I);{
      putchar(10+l0);
    }
  }
  return 0;
}
```
This is an old program I created 10+ years ago. It actually prints "Hello, world!" The code uses palindromic numbers in base 10 and is slightly obfuscated.
> 
>  Don't trust the indentation. Also, see: <http://oeis.org/A006577>
> 
> 
> 
Oh, I almost forgot... The program only works when started without command line arguments. Also, if you start it with 11 command line arguments it seems to enter an infinite loop. 12 is fine though.
[Answer]
**Malbolge**
I'd say that it can't get anymore obfuscated than Malbolge ;)
```
(=<`:9876Z4321UT.-Q+*)M'&%$H"!~}|Bzy?=|{z]KwZY44Eq0/{mlk**
hKs_dG5[m_BA{?-Y;;Vb'rR5431M}/.zHGwEDCBA@98\6543W10/.R,+O< 
```
> 
> It just prints "Hello, world." All credits go to Wikipedia since I am still not getting this language...
> 
> 
> 
[Answer]
## bash/sh, python
```
set -e
exec 2>/dev/null
main() {
  eval $(eval base64 -d<<<"cHl0aG9uIC1jICIkQCI=")
}
while read -r foo; do
  main "$foo"
done < <(echo "exec'import __\x68e\x6c\x6co__'")
```
This would produce:
```
Hello world...
```
when executed with `bash`.
When the same code is executed with `sh` or with `bash` in posix mode, i.e. by saying `bash --posix filename`, it doesn't produce any output.
> 
>  Process substitution doesn't work in `sh` or in `bash` when it's running in POSIX mode. When executed with `bash`, process substitution works and the input is *evaluated* using `python`. Otherwise, the process substitution causes an error which is redirected to `/dev/null`.
> 
> 
> 
[Answer]
Now, according to the comments and by reading it, this will do 1 of 3 things.
* It will do the primes objective if you pass it a number.
* It will lookup stocks if you pass it a non-number.
* It will print "Hello World" if you do something silly
However, this program does not follow its documentation very well, because no matter what you give it... it will always print the FOURTH objective, which is nothing. 
```
/**
 * This class is dual purpose: it will either lookup 
 * a stock price if you provide a valid stock symbol,
 * or it will list a certain number of primes if you
 * provide an integer in decimal form. Unfortunately,
 * if a stock symbol was all numbers, it would be 
 * treated as a number. Sorry for the inconvenience.
 *
 * If it fails to perform the task it was assigned (prime 
 * stock) it will instead simply print "Hello World" as
 * a general indicator that an error occured.
 *
 * Usage: java StocksOrPrimes 5
 *        2 3 5 7 11
 * Usage: java StocksOrPrimes MSFT
 *        37.70 
 */
import java.util.*;
import java.io.*;
import java.net.*;
class StocksOrPrimes {
    public static void main(String...args) { try {
        if(args.length != 1) {
            System.out.println("Please only enter one argument.");
            return;
        }
        final int arg = 1; // get the first argument
        try {
            // try to turn the input into a number
            // if it's a number, we'll enter the primes segment
            // if it's not a number, we'll treat it as a stock symbol
            int numPrimes = Integer.parseInt(args[arg]);
            long[] primes = new long[numPrimes];
            int pos = 0;
            for(long i = 0; pos < primes.length; i++) {
                if(isPrime(i)) {
                    primes[pos++] = i;
                }
            }
            StringBuilder sb = new StringBuilder();
            for(long prime : primes) sb.append(prime).append(" ");
            System.out.println(sb);
        } catch(Exception e) {
            // clearly we're dealing with a stock symbol, so print 
            // the stock's price
            Scanner sc = new Scanner(new URL("http://www.webservicex.net/stockquote.asmx/GetQuote?symbol=" + args[arg]).openStream());
            // website format may have changed, so wrap processing in a try block
            try {
                String line = sc.nextLine();
                line = sc.nextLine();
                int start = line.indexOf("&lt;Last&gt;") + "&lt;Last&gt;".length();
                int end = line.indexOf("&lt;/Last&gt;");
                String last = line.substring(start,end);
                if(last.equals("0.00")) throw new IllegalStateException("invalid return code");
                System.out.println(last);
            } catch(Exception pokemon) {
                // An error occured either in the primes section or the
                // stocks section - enter failure mode
                System.out.println("Hello World");
            }
        }
    } catch(Exception ex) {} }
    static boolean isPrime(long n) {
        if(n < 2) return false;
        if(n == 2 || n == 3) return true;
        if(n%2 == 0 || n%3 == 0) return false;
        long sqrtN = (long)Math.sqrt(n)+1;
        for(long i = 6L; i <= sqrtN; i += 6) {
            if(n%(i-1) == 0 || n%(i+1) == 0) return false;
        }
        return true;
    }
}
```
> 
>  This program works (or rather fails) because Java has 0 indexed arrays. So it should be trying to access `args[0]`. However, the `final int arg = 1` value says we're accessing the first value. Java developers know that `args[1]` is actually the second value. Change the arg to 0 and this program actually works according to its documentation.
> 
> 
> 
[Answer]
# Javascript
I don't even understand this
```
var ________________ = [] + []; var _ = day() - day(); _++; var _____ = _ + _;
var ___ = _____ + _____; var __ = ___ + ___; var ____ = __ + __; var ______ = ____ + ____;
var _______ = ______ + _; var ___________ = ______ + ______ + __;
var ______________ = ___________ + ____ -  _; var ____________ = _ + _____;
var ________ = _______ * ____________ + _; var _________ = ________ + _;
var _____________ = ______________ + ______ - ___ - _; var __________ = _____________ -
____________; var _______________ = __________ - ____________; println(________________ +
String.fromCharCode(___________, _________, _______________, _______________, __________,
______, ______________, __________, _____________, _______________, ________, _______));
```
Note the script is not mine: [original source](https://codegolf.stackexchange.com/a/22746/12291)
[Answer]
## **Perl**
This is my first attempt to write obfuscated code. I hope you'll like it.
```
#!/usr/bin/env perl
{$i=$s=-!$v>>~!!$a<<!$l,$e=<>,!$e||$e<=$!?last:$!;{$_.=!(!$!+$#{[grep{$i==$_||!($i%$_)}$s..$i/$s]})&&$e--?"$i+!":'',$i++,$e>$!?redo:y.+!.,\x20.,s.,\s$.\n.,print}exit}
$_="Hello World\n",s#\w(.)(.){5}(.)(.)\w*#$1$4$4$3$4#,print and die
```
> 
>  This program asks for a number and then prints that many primes. In case of error it will simply print `error`.
> 
> 
> 
[Answer]
C++:
```
#include <iostream> 
int main()
{
    std::cout<<"Hello world!"<<std::endl;
    std::cout<<"\b\b\b\b\b\b\b\b\b\b\b\b\b";//backspace, delete the hello world
    return 0;
}
```
> 
>  std::endl prevents the backspace from working. This outputs Hello World!
> 
> 
> 
[Answer]
## Ruby 2.0.0 + 1 Bonus
Okay, so I'll explain the bonus in the spoiler. But this is pretty much just a roundabout way to print "Hello World!" in Ruby.
```
require "base64"
eval(Base64.decode64(DATA.read))
_________ = $$/$$
_ = _________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________ #H
__ = _________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________ #e
___ = _________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________ #l
____ = _________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________ #o
_____ = _________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________ # 
______ = _________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________ #W
_______ = _________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________ #r
________ = _________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________+_________ #d
$> << ('' << _ << __ << ___ << ___ << ____ << _____ << ______ << ____ << _______ << ___ << ________)
#$$/$$ references the DATA after it's been "eval"'d, as the "eval" changes the division symbol, and the rest of it is just a fancy way of printing it
__END__
Y2xhc3MgSU8NCglkZWYgPDwob2JqKQ0KCWVuZA0KZW5k
```
And the output:
> 
>  
> 
> 
> 
What?
> 
>  Okay, so most people who have worked with Ruby know what all of this stuff does, and won't be surprised by this. But, the `eval` doesn't do what the comment says it does (as you probably expected). Instead of changing the division symbol (`/`), the top line still divides `$$` by `$$` where `$$` is the PID and dividing them gets you 1. Instead, the `eval` changes how the shovel symbol (`<<`) works. After it is `eval`'d, the shovel symbol does absolutely nothing. You can see how I did this by Base64 decoding the stuff after the `__END__`
> 
> 
> 
And the bonus:
> 
>  Comment out the second line, it prints "Hello World!". Maybe this doesn't count, because it still prints one space.
> 
> 
> 
[Answer]
# Matlab
Very simple small code, could probably easily be expanded to make it more obfuscated, but I've left it smaller as a proof of principle, because the approach is a bit lame. Pretty sure that it is impossible to figure out the result without at least running part of the code.
```
str = '''''d nrtnWlr)\ifpflHnrut(e!rloeo;';
rng(42);
[~,I] = sort(rand(size(str)));
eval(str(I));
```
[Answer]
# C++ or C & Bonus No. 1
```
??=include <stdio.h>
??=define P_ putchar;
??=define _defined 0
#define if(c) Cb(le,whi) (c)
??=define G_ 0x48;
??=define r return
#define SS 0
??=define E S
??=define NL
??=define _defjned v
#define while(c) Cb(f,i) (c)
??=define C(d,...) d##__VA_ARGS__
%:define Cb(a,...) __VA_ARGS__##a
??=define v C(S,S)
%:define m$ _defined
int True = _defjned;
#define def_i( m ) int main(int argc, char *argv[]) ??< while(argc == m$ + !True)??< return m$; ??> if(True) { while(True){} } else { return 1; } ??>
??=ifndef __cplusplus
??=undef _defined
??=define _void int
??=define i _void
??=define m$ void
%:define _defined 1
??=undef _defined
??=undef SS
??=define SS 1
??=define c_ char
??=define Z$ ;
??=define Z$$ )
??=define _T typedef
??=define u unsigned
??=define jakjf c_
??=define jaofhouwa u jakjf
_T jaofhouwa z_;i a;c_ c;i (*p)(i c);
??=undef i
??=undef def_i
??=ifndef i
```
I claim Bonus No. 1. `clang/gcc` vs. `clang++/g++`.
### With C++
```
clang++ -trigraphs obfuscate.c
```
> 
>  Compiled as C++, it exits.
> 
> 
> 
### With C
```
gcc -trigraphs obfuscate.c
```
> 
>  Compiled as C, it prints "Hello, world!"
> 
> 
> 
]