text:
Solve the Halting Problem for Befinge
Let's define a simple 2D language, which we'll give the incredibly original name befinge. Befinge has 5 instructions:

<>^v, as in most 2D esolangs, redirect the instruction pointer in their respective directions.
. is  a no-op.

The instruction pointer starts out at the top-left corner going right. If the instruction pointer gets to an edge, the program halts. Every Befinge program will obviously either halt or go into an infinite loop which does nothing. Here are two examples:
Halting:
>.v
..<

Non-Halting:
>....v
..v..<
..>v..
^..<..

The halting problem is not solvable for a Turing-complete language, but it is for this one. Your task is to write a program (or function) that takes as input a string representing the befinge program and returns a truthy or falsey value depending on whether it halts or not.

You can assume that the input will consist only of these characters and will be padded with spaces to form a rectangle.
You can use any set of five characters for the instructions (e.g. adws ).

Test Cases
Halting:
.

v>
>^

....v....
....>...v
.^..<....
.......v<
.......v.
....^..<.

v<>v>v^
>v^>^>v
<>>^v<v
v^<>v^<

Non-Halting:
>..v
^..<

>v<
v<.
>v.
v<.
>.^

>.>.>.v
.><.<.<

This is code-golf, so the shortest program (in bytes) wins.

What about 아희(Aheui)?

Some test cases where not every arrow is hit would be good.

Turing proved that the Halting problem is not solvable for any Turing-Complete language, so I had to make up a fake one that wasn't Turing complete. A language that will always eventually halt is not Turing complete.

We also don't have any examples where the path makes a non-90-degree turn like >..>. or ><.

Related (slightly harder version)

Related

"work how you'd expect", could you elaborate a bit on that?

@EsolangingFruit Why not just use the calculus of constructions? It's halting problem is also computable (assuming ZFC is consistient).

@PyRulez Because I wanted processing directional motion to be part of the challenge.

ES6 (JavaScript), 111,101 bytes
EDIT: changed output values to true and false, instead of Y and N, to shave off 10 bytes more
Golfed
F=(I,M=[...I],c=0,i)=>(i={j:v=I.search`\n`+1,k:-v,h:-1,l:1,q:i,0:0}[M[c]])?F(I,M,c+i+(M[c]=0),i):i!=0

Test
F=(I,M=[...I],c=0,i)=>(i={j:v=I.search`\n`+1,k:-v,h:-1,l:1,q:i,0:0}[M[c]])?F(I,M,c+i+(M[c]=0),i):i!=0

//Alphabet Map
tr={
'<':'h',
'>':'l',
'^':'k',
'v':'j',
'.':'q',
'\n':'\n'
};

//Test
T=(I,A)=>{
console.log({"Y":"#Halting","N":"#Non-Halting"}[A]);
console.log("I=\n",I,"\nF(I)=",O=F([...I].map(s=>tr[s]).join('')));
console.log('NY'[O*1] == A ? "OK !" : "NOT OK !");
}

//Halting
T(
`>.v
..<`
,'Y');

//Non-Halting
T(
`>....v
..v..<
..>v..
^..<..`
,'N');

//Halting
T(
`.`
,'Y')

//Halting
T(
`v>
>^`
,'Y');

//Halting
T(
`....v....
....>...v
.^..<....
.......v<
.......v.
....^..<.`
,'Y');

//Halting
T(
`v<>v>v^
>v^>^>v
<>>^v<v
v^<>v^<`
,'Y');

//Non-Halting
T(
`>..v
^..<`
,'N');

//Non-Halting
T(
`>v<
v<.
>v.
v<.
>.^`
,'N');

//Non-Halting
T(
`>.>.>.v
.><.<.<`
,'N');

Sample Output
#Halting
I=
>.v
..<
F(I)= true
OK !

#Non-Halting
I=
>....v
..v..<
..>v..
^..<..
F(I)= false
OK !

#Halting
I=
 .
F(I)= true
OK !

#Halting
I=
v>
>^
F(I)= true
OK !

#Halting
I=
....v....
....>...v
.^..<....
.......v<
.......v.
....^..<.
F(I)= true
OK !

#Halting
I=
v<>v>v^
>v^>^>v
<>>^v<v
v^<>v^<
F(I)= true
OK !

#Non-Halting
I=
>..v
^..<
F(I)= false
OK !

#Non-Halting
I=
>v<
v<.
>v.
v<.
>.^
F(I)= false
OK !

#Non-Halting
I=
>.>.>.v
.><.<.<
F(I)= false
OK !

You can't just use Y and N as output as in JavaScript they are both truthy.

Befunge-98 (PyFunge), 217 209 200 bytes
#v10dpf1dp12dp3dpk
 >#v~:a-#v_$10dp1dg1+1dp >
v  >10dp;>0dg1dgp0dg1+0dp^;f1dp
>0dg1dgg:'^-#v_n1-v
^<v01_v#!->':<
  <   >:'<-#v_01-0>   v
v^pd1+gd3gd1[:'v-#v_01>3dp2dpndg1dgp
>0dg2dg+0dp ^ @.!;>:'.-#;_

Try it online!
A befinge halting problem needs a befunge solution.
Returns 0 for truthy and 1 for falsey.
Puts the input on the grid starting from 1,15 and then moves on top, replacing the arrows with zeros. As soon as we hit a zero, we know it loops. Anything besides ><^v. and zero is considerd to halt the program, which includes the border of spaces we get around the program by placing it on the grid slightly offset.
One easy way to shave off a few bites would be to use numbers instead of ><^v. but I don't feel like that's worth it.

A befinge halting problem needs a befunge solution. Precisely. +1

Python 2, 116 105 bytes
x=1
X=Y=y=0
H=[]
G=input()
while(X,Y,x,y)not in H:H+=[(X,Y,x,y)];C=ord(G[Y][X]);x=C%3-1;y=C%5-1;X+=x;Y+=y

Try it online!
The challenge is old, but I figured since this is the shortest Python, I will post it. Input is a list of strings, but the characters used are unusual.
> G
< B
v C
^ F
. L

For example, the third halting example turns into ['LLLLCLLLL', 'LLLLGLLLC', 'LFLLBLLLL', 'LLLLLLLCB', 'LLLLLLLCL', 'LLLLFLLBL'].
Output is via exit code, 0 (success) for non-halting, and 1 (error) for halting. Any tips or tricks appreciated.

JavaScript (Node.js), 80 bytes
f=(a,v=1,x=0,[t,...u]=a,n=1+a.search`
`,c=a[x])=>t?f(a,v=+c?c-2||v:c+n,x-v,u):!c

Try it online!
JavaScript (Node.js), 86 bytes
f=(a,v=1,x=0,[t,...u]=a,n=1+a.search`
`,c=a[x])=>t?c>' '<=f(a,v=+c?c-2||v:c+n,x-v,u):0

Try it online!

JavaScript (ES6), 158 127 bytes
f=(a,x=0,y=0,d=1,e=0,c=a[y]&&a[y][x])=>c<'~'?(c>'.'&&(a[y][x]='~',d=(c=='>')-(c=='<'),e=(c=='v')-(c=='^')),f(a,x+d,y+e,d,e)):!c

Takes input as a two-dimensional character array and returns true for halting and false for an infinite loop. Works by setting visited direction characters to ~s as it recursively traverses them. Edit: Saved 31 bytes by updating my direction vector before recursing.
Abusing the instruction characters (1=^ 4=< 5=. 6=> 9=v) takes me down to 101 bytes:
f=(a,x=0,y=0,d=1,e=0,c=a[y]&&a[y][x])=>+c?(c-5&&(a[y][x]='0',d=~-c%4,e=~-(c>>2)),f(a,x+d,y+e,d,e)):!c

Takes input as a two-dimensional character array

Is a differently formatted input permitted ? (going from a flat string to an array do take bytes too).

@zeppelin My belief is that this is allowed. See http://meta.codegolf.stackexchange.com/q/2214/17602 for instance.

ReferenceError: f is not defined

@l4m2 Bah, I've done it again, I've included the f= in the byte count but not the code...

Turtlèd, 146 bytes
!u[*.[ r+.]l[ l]dr_+]#*#[ u]d[ (.r)(>.r{.r}@>)(v.d{.d}@v)(<.l{.l}@<)(^.u{.u}@^)(*@0' )],@1(0@0)(v' d)(<' r)(>' l)(^' d)[ u]d[ l]r[ [ r]l[ ' l]dr],

This program takes I/O differently: please terminate each line with a space, including the last one. Turtlèd doesn't like newlines, as it uses a grid for it's second dimension of characters.
Try it online!
0 for loops forever, 1 for halts.
General explanation:
It writes the input on the grid, then it actually follows the path the arrows make around the grid, replacing each arrow with a * as it goes, also saving the direction in the char var. If it encounters an *, an arrow it hit before, the program would not halt, so it sets the char var to 0, exit the loop. Otherwise, it will hit the end of the grid and exit the loop. It will write the char var. If it hit the end of grid, it uses the direction stored in the char var to get back to the grid, and sets the char var to 1, for halts. If the char var was actually 0, not a direction, it does not need to get back, as it is still there, and it sets it back to 0. It clears the grid off, then writes the char var, 1 for halts, else 0.

SmileBASIC, 158 145 bytes
If the same arrow is encountered more than once, the program will never halt.
When the instruction pointer passes an arrow, it's replaced with a different symbol, which will cause the function to return 0 if it's reached again.
If the IP goes out of bounds, it returns 1.
DEF H P@L
C=VAL(P[Y][X])IF C>8THEN?0RETURN
IF C THEN D=C-1P[Y][X]="9
X=X+!D-(D==1)Y=Y+(D==2)-(D>2)IF X+1&&Y+1&&Y-LEN(P)&&X-LEN(P[0])GOTO@L
?1
END

Takes input as an array of strings. <any non-digit chracter>,1,2,3,4 = .,>,<,v,^

Python 2, 182 bytes
m,v,d,x,y=input(),[],'>',0,0
try:
 while 1:
  if[x,y]in v:print 0;break
  c=m[y][x]
  if c!='.':d=c;v+=[[x,y]]
  if d in'><':x+=[-1,1][d=='>']
  else:y+=[-1,1][d=='v']
except:print 1

Takes a string array as input. I have to golf this more but for now it's time to stress over the election.
Ungolfed:
input = input()

visited = [  ]

dir = ">"
x=0
y=0

try:
    while True:
        if[x,y]in visited:print False;break
        char=input[y][x]
        if char!=".":
            dir=char
            visited+=[[x,y]]

        if dir==">":
            x+=1
        if dir=="<":
            x-=1
        if dir=="v":
            y+=1
        if dir=="^":
            x-=1
except:
    print True

hey, what if you took the main part out of the try, and put only the c=m[y][x] in a try and except? this would also allow you to replace break with 1/0, as well as reducing indents.

[-1,1][d=='v'] -> 2*(d>'>')-1 and [-1,1][d=='>'] -> 2*(d>'<')-1 save a total of 6 bytes.

Wrong answer for ["<>"]

Clojure, 143 bytes
#((fn[p v i s](if-let[v({\> 1\< -1\^(- s)\. v\v s}(get % p))](if(neg? i)1(recur(+ p v)v(dec i)s))))0 1 1e9(+(count(take-while(set"<>v^.")%))1))

A function with 4 state arguments: position p, velocity v, step index i and size of one line s. Returns 1 if we didn't go out of bounds in 10^9 steps and nil otherwise. Actually how many steps do we need to check to be sure, (count %)? I think it is more than that as same NOP can be traversed horizontally and vertically.
Can be called like this (takes normal strings as arguments, get returns nil when out of bounds):
(def f #( ... ))
(f ">....v\n..v..<\n..>v..\n^..<..")
(f "v>\n>^")
(f "....v....\n....>...v\n.^..<....\n.......v<\n.......v.\n....^..<.")

State transitions (+1, -1, +s, -s) are encoded in the dictionary {\> 1\< -1\^(- s)\. v\v s}.

4 times the number of grid characters should be enough: if the pointer comes back to the same character with the same incoming direction, then it's in an infinite loop.

Python 2/3, 201 192 bytes
def f(x):
 X=Y=b=0;a=1;D={}
 while len(x)>Y>-1<X<len(x[Y]):
  try:
   a,b={'>':(1,0),'^':(0,-1),'<':(-1,0),'v':(0,1)}[x[Y][X]]
   if(X,Y)in D:return 0
  except:0
  D[X,Y]=0;X+=a;Y+=b
 return 1

Try it online!
Gives correct answer for ["<>"]

I believe you can save several bytes by changing from a function to a full program. You can replace def f(x): with x=input() with 0 byte difference, then remove the extra indentation (-8 bytes), then replace return x with exit(x)(allowed per meta consensus), for another 2 bytes. Anyway, nice solution!

Java, 477
I know that this is not winning, n=and can probably be golfed more, but it implments a similar method as to what the other answers use, but this one uses hashmap to perform lookups. The input is using the symbols ><^v and anything other than that for the no op. Input comes through args.
GOLFED
import java.util.*;interface B{static void main(String[]a){HashMap<String,Byte>h=new HashMap<>();int x,y=0;for(String s:a){x=0;for(char c:s.toCharArray()){if("><^v".indexOf(c)>-1)h.put(x+","+y,(byte)c);x++;}y++;}x=0;y=0;int d=0;int D=0;while(x>-1&&x<a[0].length()&&y<a.length&&y>-1){Byte v=h.get(x+","+y);if(v!=null){if(v==0){System.out.print(0);return;}d=(v<85)?"<>".indexOf(v)*2-1:0;D=(v>84)?"^v".indexOf(v)*2-1:0;}h.replace(x+","+y,(byte)0);x+=d;y+=D;}System.out.print(1);}}

UNGOLFED
import java.util.*;
interface B{
    static void main(String a[]) {
        HashMap<String, Byte> h = new HashMap<>();
        int x, y = 0;
        for(String s : a) {
            x = 0;
            for(char c : s.toCharArray()) {
                if ("><^v".indexOf(c) > -1) h.put(x + "," + y, (byte) c);
                x++;
            }
            y++;
        }
        x = 0;
        y = 0;
        int d = 0;
        int D = 0;
        while(x > -1 && x < a[0].length() && y < a.length && y > -1) {
            Byte v = h.get(x + "," + y);
            if(v != null) {
                if(v == 0) {System.out.print(0); return;}
                d = (v < 85) ? "<>".indexOf(v)*2-1 : 0;
                D = (v > 84) ? "^v".indexOf(v)*2-1 : 0;
            }
            h.replace(x + "," + y, (byte) 0);
            x += d;
            y += D;
        }
        System.out.print(1);
    }
}

Explanation coming soon!

One small thing: you can change String a[] to String[]a and omit the space.

You can also use var in a lot of places if you use Java 10.

410 bytes


text:
Reverse an xxd hexdump
Given an xxd hexdump such as this one:
00000000: 1f8b 0808 4920 2258 0003 7069 6c6c 6f77  ....I "X..pillow
00000010: 2e74 7874 00d3 d707 8218 10d0 2799 c545  .txt........'..E
00000020: ba96 41a1 994c 7d60 d650 d53c 44a3 8a22  ..A..L}`.P.<D.."
00000030: cd43 34aa 28d2 3c44 a38a 22cd 4334 aa28  .C4.(.<D..".C4.(
00000040: d20c 00fd 512d 46b8 0500 00              ....Q-F....

Reverse it to produce the original input:
I "Xpillow.txt����'��E��A��L}`�P�<D��"�C4�(�<D��"�C4�(�
                                                      �Q-F�

(This is only an approximation of the original input)
You do not need to expand to shellcodes.
Dupe alert
This is not a duplicate of the other xxd hexdump challenge because this one does not to be expanded to shellcodes.
Rules

You may not use external programs that parse hexdumps (such as xxd).
Standard loopholes apply
This is code-golf, smallest code wins.

There's more than one previous xxd question.

V, 27 bytes
ÎdW40|D
Í üî
Ó../<C-v><C-v>x&
éiD@"

Try it online!
Note that <C-v> represents the unprintable character 0x16.
Explanation
This answer is pretty fun because it's about modifying the input into V code and then executing that code. I'll explain each command one at a time
Î                " On every line:
 dW              "   Delete a word
   40|           "   Move to the 40th column
      D          "   Delete everything after this

Í                " Remove all occurrences of
                 " A space
  üî             " or a newline

Now the buffer looks like this:
1f8b080849202258000370696c6c6f772e74787400d3d707821810d02799c545ba9641a1994c7d60d650d53c44a38a22cd4334aa28d23c44a38a22cd4334aa28d20c00fd512d46b8050000

The command to insert a character by its hex value is
<C-v>x<hex-value>

Here is where we start transforming it into actual V code.
Ó                " Replace
 ..              "   Two characters
   /             "   with
    <C-v><C-v>x  "   the text "<C-v>x"
               & "   And the two characters we just matched

<C-v>x1fi<C-v>x8bi<C-v>x08i<C-v>x08i<C-v>x49...

But the command has to be in insert mode. So we insert an 'i' at the beginning.
éi               " Insert an 'i'
  D              " Delete this line
   @"            " And evaluate it as V code

source: Stack Exchange

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

sort: votes


text:
Print a ballot!
As you all know, today is election day!
Your task today is to print out a ballot, given an input.
If the input is Hillary Clinton, print:
Hillary Clinton   ===-----===>
Donald Trump      ===     ===>
____________      ===     ===>

However, if the input is Donald Trump, print:
Hillary Clinton   ===     ===>
Donald Trump      ===-----===>
____________      ===     ===>

If it is something else, write it on the third line:
Hillary Clinton   ===     ===>
Donald Trump      ===     ===>
Oliver Ni         ===-----===>

(Technically, I'm not 18 yet...)
Remember, this is code-golf, so the code with the fewest bytes wins.

No "none of the above option"? :)

@KritixiLithos Hm, nah...

Any max length on the name of "something else"? (There are 18 characters before the first equal sign in your examples)

Is it case sensitive or insensitive? Judging by the test cases I'm assuming sensitive at the moment.

@KritixiLithos but that would be rigging the system!

Jelly, 55 53 bytes
³ẇị⁾- x5⁾ =,”=x3¤j;”>ṭ
ṭ“Gụ©l⁴“%eŻƤ(»”_x12¤ṭQḣ3z⁶ZÇ€Y

Try it online!
Explanation
³ẇị⁾- x5⁾ =,”=x3¤j;”>ṭ   Helper link. Argument: row
³ẇ                       Check if the user's vote is in this row
  ị⁾-                    Take "-" if it was, " " otherwise
      x5                 Take five of that character
        ⁾ =,”=           Take the array [" =", "="]
              x3         Turn it into ["   ===", "==="]
                ¤        Combine the two previous steps into a nilad
                 j       Join the list by the five character string
                  ;”>    Add ">"
                     ṭ   Prepend the original row

ṭ“Gụ©l⁴“%eŻƤ(»”_x12¤ṭQḣ3z⁶ZÇ€Y   Main link. Argument: vote
 “Gụ©l⁴“%eŻƤ(»                   Take the array ["Hillary Clinton", "Donald Trump"]
ṭ                                Add the user's vote to the list
              ”_                 Take "_"
                x12              Take twelve times that
                   ¤             Combine the two previous steps into a nilad
                    ṭ            Add that string to the list
                     Q           Remove duplicates
                      ḣ3         Take the three first items
                        z⁶       Transpose, padding with spaces
                          Z      Transpose back
                           Ç€    Apply the helper to each row
                             Y   Join with newlines

05AB1E, 74 59 57 bytes
Uses CP-1252 encoding.
”ŽÏaryµÍ””¹Ñ Trump”I'_12×)Ù3£vyð18yg-×„ -¹yQè5×'=3×.ø'>J,

Try it online!

Python 2, 127 bytes
X=['Hillary Clinton','Donald Trump']
i=input()
X+=[[i],['_'*12]][i in X]
for x in X:print x.ljust(18)+'==='+' -'[i==x]*5+'===>'

JavaScript (ES6), 149 bytes
s=>['Hillary Clinton','Donald Trump',0].map(S=>((S?S:s||'____________')+p+p+p+p+p).slice(0,18)+`===${!S^S==s?(s=0,'-----'):p}===>`,p='     ').join`
`

Demo

let f =

s=>['Hillary Clinton','Donald Trump',0].map(S=>((S?S:s||'____________')+p+p+p+p+p).slice(0,18)+`===${!S^S==s?(s=0,'-----'):p}===>`,p='     ').join`
`

console.log(f('Hillary Clinton'))
console.log(f('Donald Trump'))
console.log(f('Obi-Wan Kenobi'))

Java 7, 390 339 335 bytes
String c(String s){String h="Hillary Clinton",d="Donald Trump",r=h+"   ===Q===>\n"+d+"      ===X===>\nZ===J===>";boolean H=h.equals(s),D=d.equals(s);for(int i=s.length();i++<18;s+=" ");return r.replace(H?"Q":D?"X":"J","-----").replace(H|D?"Z":"~","____________      ").replaceAll(H?"X|J":D?"Q|J":"Q|X","     ").replace(H|D?"~":"Z",s);}

Ungolfed & test code:
Try it here.
class M{
  static String c(String s){
    String h = "Hillary Clinton",
           d = "Donald Trump",
           r = h+"   ===Q===>\n"+d+"      ===X===>\nZ===J===>";
    boolean H = h.equals(s),
            D = d.equals(s);
    for(int i = s.length(); i++ < 18; s += " ");
    return r.replace(H?"Q":D?"X":"J", "-----")
            .replace(H|D?"Z":"~", "____________      ")
            .replaceAll(H?"X|J":D?"Q|J":"Q|X", "     ")
            .replace(H|D?"~":"Z", s);
  }

  public static void main(String[] a){
    System.out.println(c("Hillary Clinton"));
    System.out.println();
    System.out.println(c("Donald Trump"));
    System.out.println();
    System.out.println(c("Anyone else?.."));
    System.out.println();
    System.out.println(c("S"));
    System.out.println();
    System.out.println(c("Anyone who is willing to take the job"));
  }
}

Output:
Hillary Clinton   ===-----===>
Donald Trump      ===     ===>
____________      ===     ===>

Hillary Clinton   ===     ===>
Donald Trump      ===-----===>
____________      ===     ===>

Hillary Clinton   ===     ===>
Donald Trump      ===     ===>
Anyone else?..    ===-----===>

Hillary Clinton   ===     ===>
Donald Trump      ===     ===>
S                 ===-----===>

Hillary Clinton   ===     ===>
Donald Trump      ===     ===>
Anyone who is willing to take the job===-----===>

V, 104 bytes
OHillary Clinton³ ³=µ ³=>YpRDonald Trump   p15r_ñ/^¨á« á«¾©.*î¨.*î©*\1
22|5r-Gdññ3GjéRDk@"Í_/
22|5r-

Try it online!
This answer is way too hacky, and way too long. I guess that's what you get when you design a golfing-language off of a text-editor. ¯\_(ツ)_/¯

wait what does O do? It looks like it functions like i

@conor That's correct, they both enter insert mode. The only difference is where in the buffer the cursor starts. There's also iIaAoOsSR that all enter insert mode in some way or another

Batch, 210 bytes
@set s=%1
@call:l %1 "Hillary Clinton"
@call:l %1 "Donald Trump"
@call:l %1 %s%
@exit/b
:l
@set v=
@if %1==%2 set v=-----&set s=____________
@set t=%~2
@echo %t:~0,18%===%v%===^>

Note: the line @set v= has 5 trailing spaces, and the line @set t=%~2 has 18. Accepts input as a quoted command-line parameter.

C#, 266 Bytes
Golfed:
string B(string s){var h="Hilary Clinton".PadRight(17);var d="Donald Trump".PadRight(17);var r="===     ===>\n";var c=r.Replace(" ", "-");var b="____________".PadRight(17);return s==h.Trim()?s.PadRight(17)+c+d+r+b+r:s==d.Trim()?h+r+d+c+b+r:h+r+d+r+s.PadRight(17)+c;}

Ungolfed:
public string B(string s)
{
  var h = "Hilary Clinton".PadRight(17);
  var d = "Donald Trump".PadRight(17);
  var r = "===     ===>\n";
  var c = r.Replace(" ", "-");
  var b = "____________".PadRight(17);
  return s == h.Trim() ? s.PadRight(17) + c + d + r + b + r :
    s == d.Trim() ? h + r + d + c + b + r :
      h + r + d + r + s.PadRight(17) + c;
}

Tried to create a Func for all those PadRights...Exactly the same byte count...
Testing:
var printABallot = new PrintABallot();
Console.WriteLine(printABallot.B("Hilary Clinton"));

Hilary Clinton   ===-----===>
Donald Trump     ===     ===>
____________     ===     ===>

Console.WriteLine(printABallot.B("Donald Trump"));

Hilary Clinton   ===     ===>
Donald Trump     ===-----===>
____________     ===     ===>

Console.WriteLine(printABallot.B("Kanye West"));

Hilary Clinton   ===     ===>
Donald Trump     ===     ===>
Kanye West       ===-----===>

Python 3.6, 132 bytes
i=input()
s=['Hillary Clinton','Donald Trump','_'*12]
if x not in s:s[2]=i
for k in s:print(f'{k:18}==={" -"[k==i]*5}===>')

Uses 3.6's new f-strings.

Pyth, 76 bytes
V{+_tW!}zJ[*\_12"Donald Trump""Hillary Clinton")Jzs[.[Nd18K*\=3*?qzN\-d5K\>

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


text:
Compute the perimeter density matrix
Introduction
The perimeter density matrix is an infinite binary matrix M defined as follows.
Consider a (1-based) index (x, y), and denote by M[x, y] the rectangular sub-matrix spanned by the corner (1, 1) and (x, y).
Suppose that all values of M[x, y] except Mx, y, the value at index (x, y), have already been determined.
Then the value Mx, y is whichever of 0 or 1 that puts the average value of M[x, y] closer to 1 / (x + y).
In case of a tie, choose Mx, y = 1.
This is the sub-matrix M[20, 20] with zeros replaced by dots for clarity:
1 . . . . . . . . . . . . . . . . . . .
. . . . . 1 . . . . . . . . . . . . . .
. . 1 . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . 1 . . . . . . . . . . . . . . .
. 1 . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . 1 . .
. . . . . . . . . . . . . . 1 . . . . .
. . . . . . . . . . . . 1 . . . . . . .
. . . . . . . . . . 1 . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . 1 . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . 1 . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . 1 . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .

For example, we have M1, 1 = 1 at the upper left corner, since 1 / (1 + 1) = ½, and the average of the 1 × 1 sub-matrix M[1, 1] is either 0 or 1; that's a tie, so we choose 1.
Consider then the position (3, 4).
We have 1 / (3 + 4) = 1/7, and the average of the sub-matrix M[3, 4] is 1/6 if we choose 0, and 3/12 if we choose 1.
The former is closer to 1/7, so we choose M3, 4 = 0.
Here is the sub-matrix M[800, 800] as an image, showing some of its intricate structure.
The task
Given a positive integer N < 1000, output the N × N sub-matrix M[N, N], in any reasonable format.
The lowest byte count wins.

R, 158 154 141  bytes
Edit: Because the only 1 in the upper 2x2 submatrix is the top left M[1,1] we can start the search for 1s when {x,y}>1 so no need for the if statement.
M=matrix(0,n<-scan(),n);M[1]=1;for(i in 2:n)for(j in 2:n){y=x=M[1:i,1:j];x[i,j]=0;y[i,j]=1;d=1/(i+j);M[i,j]=abs(d-mean(x))>=abs(d-mean(y))};M

The solution is highly inefficient as the matrix is duplicated twice for each iteration. n=1000 took just under two and a half hours to run and produces a matrix of 7.6 Mb.
Ungolfed and explained
M=matrix(0,n<-scan(),n);                        # Read input from stdin and initialize matrix with 0s
M[1]=1;                                         # Set top left element to 1
for(i in 2:n){                                  # For each row
    for(j in 2:n){                              # For each column
        y=x=M[1:i,1:j];                         # Generate two copies of M with i rows and j columns
        x[i,j]=0;                               # Set bottom right element to 0
        y[i,j]=1;                               # Set bottom right element to 1
        d=1/(i+j);                              # Calculate inverse of sum of indices
        M[i,j]=abs(d-mean(x))>=abs(d-mean(y))   # Returns FALSE if mean(x) is closer to d and TRUE if mean(y) is
    }
};
M                                               # Print to stdout

Output for n=20
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     1    0    0    0    0    0    0    0    0     0     0     0     0     0     0     0     0     0     0     0
[2,]     0    0    0    0    0    1    0    0    0     0     0     0     0     0     0     0     0     0     0     0
[3,]     0    0    1    0    0    0    0    0    0     0     0     0     0     0     0     0     0     0     0     0
[4,]     0    0    0    0    0    0    0    0    0     0     0     0     0     0     0     0     0     0     0     0
[5,]     0    0    0    0    1    0    0    0    0     0     0     0     0     0     0     0     0     0     0     0
[6,]     0    1    0    0    0    0    0    0    0     0     0     0     0     0     0     0     0     0     0     0
[7,]     0    0    0    0    0    0    0    0    0     0     0     0     0     0     0     0     0     0     0     0
[8,]     0    0    0    0    0    0    0    0    0     0     0     0     0     0     0     0     0     1     0     0
[9,]     0    0    0    0    0    0    0    0    0     0     0     0     0     0     1     0     0     0     0     0
[10,]    0    0    0    0    0    0    0    0    0     0     0     0     1     0     0     0     0     0     0     0
[11,]    0    0    0    0    0    0    0    0    0     0     1     0     0     0     0     0     0     0     0     0
[12,]    0    0    0    0    0    0    0    0    0     0     0     0     0     0     0     0     0     0     0     0
[13,]    0    0    0    0    0    0    0    0    0     1     0     0     0     0     0     0     0     0     0     0
[14,]    0    0    0    0    0    0    0    0    0     0     0     0     0     0     0     0     0     0     0     0
[15,]    0    0    0    0    0    0    0    0    1     0     0     0     0     0     0     0     0     0     0     0
[16,]    0    0    0    0    0    0    0    0    0     0     0     0     0     0     0     0     0     0     0     0
[17,]    0    0    0    0    0    0    0    0    0     0     0     0     0     0     0     0     0     0     0     0
[18,]    0    0    0    0    0    0    0    1    0     0     0     0     0     0     0     0     0     0     0     0
[19,]    0    0    0    0    0    0    0    0    0     0     0     0     0     0     0     0     0     0     0     0
[20,]    0    0    0    0    0    0    0    0    0     0     0     0     0     0     0     0     0     0     0     0

Python, 129 119 117 115 bytes

Replaced the loop with a list comprehension so everything can go on one line and can be lambda
Replaced .append() with :=z+[]
-2 bytes thanks to @ceilingcat for pointing out that (1+a)*(1+c) = (-a-1)*(-b-1)
-1 bytes thanks to @ceilingcat for removing the 0 from .5
-1 byte thanks to @thonnu for a more efficinet way to do and z at the end.

lambda x,z=[]:[z:=z+[~(i//x)*~(i%x)/(i//x+i%x+2)>=sum(z[k]&(k%x<=i%x)for k in range(i))+.5]for i in range(x*x)][-1]

Attempt This Online!
Rust is no longer better than python. Port of my Rust answer. Outputs a flattened matrix
Python, 118 111 bytes
def f(x,z=[]):
 for i in range(x*x):z+=[~(i//x)*~(i%x)/(i//x+i%x+2)>=sum(z[k]&(k%x<=i%x)for k in range(i))+0.5]

Attempt This Online!
Thanks to @xnor and @ceilingcat. Outputs my modifying the input in place.

117 bytes I think I/O defaults also allow taking in z=[] as input and modifying it without returning.

115 bytes (includes @ceilingcat's suggestion)

z[k]>(k%x>i%x) saves a byte, switching z from list to tuple saves another (lambda x,*z:/z:=z+(...,))

BQN, 36 bytesSBCS
+`⁼{˘>(⊣-⌊`∘-)`<˘⌊0.5+(×÷+)⌜˜1+↕}

Run online!
Two observations:

Minimizing distance of mean to 1/(x+y) is the same as minimizing distance of sum to x×y/(x+y).
At least up to 1000×1000, which is maximum size required in the challenge, there is no row or column with two ones.

The function performs three major steps:
⌊0.5+(×÷+)⌜˜1+↕ Generate matrix round(x×y/(x+y)).
(⊣-⌊`∘-)`<˘ Calculate matrix sum(M[x, y]).
+`⁼+`⁼˘ Convert that to the perimeter density matrix by performing inverse cumulative sum (+`⁼) on rows and columns.
This runs reasonably fast, generating the full 1000x1000 in ~60ms locally, but some less golfed version were a bit faster.

Scala 3, 565 476 460 458 447 440 bytes
Golfed version. Attempt this online!
Saved 125 bytes (565->440) thanks to the comment of @ceilingcat
@main def m={val n=scala.io.StdIn.readInt();val M=Array.ofDim[Int](n,n);M(0)(0)=1;for(i<-1 until n;j<-1 until n){val z=M.slice(0,i+1);val x=z.map(_.slice(0,j+1));val y=z.map(_.slice(0,j+1));x(i)(j)=0;y(i)(j)=1;val d=1.0/(i+j+2);M(i)(j)=if(a(x,d)<a(y,d))0 else 1};M.foreach(o=>{o.foreach(l=>print(if(l<1)"."else 1));println("")});def a(m:Array[Array[Int]],d:Double)=math.abs(d*m.length*m.headOption.map(_.length).getOrElse(0)-m.flatten.sum)}

Ungolfed version. Attempt this online!
import scala.io.StdIn.readInt

object Main extends App {
  val n = readInt()
  val M = Array.ofDim[Int](n, n)
  M(0)(0) = 1

  for (i <- 1 until n) {
    for (j <- 1 until n) {
      val x = M.slice(0, i + 1).map(_.slice(0, j + 1))
      val y = M.slice(0, i + 1).map(_.slice(0, j + 1))
      x(i)(j) = 0
      y(i)(j) = 1
      val d = 1.0 / (i + j + 2)

      M(i)(j) = if (math.abs(d - mean(x)) >= math.abs(d - mean(y))) 1 else 0
    }
  }

  for (row <- M) {
    for (ele <- row) {
      if (ele == 0) print(".") else print(1)
    }
    println("")
  }

  def mean(matrix: Array[Array[Int]]): Double = {
    val rowCount = matrix.length
    val colCount = matrix.headOption.map(_.length).getOrElse(0)
    matrix.flatten.sum.toDouble / (rowCount * colCount)
  }
}

Can you do import io.StdIn._ instead?

Python 2, 189 Bytes
There  are no crazy tricks in here, it is just calculating as described in the introduction. It isn't particularly quick but I don't need to create any new matrices to do this.
n=input()
k=[n*[0]for x in range(n)]
for i in range(1,-~n):
 for j in range(1,-~n):p=1.*i*j;f=sum(sum(k[l][:j])for l in range(i));d=1./(i+j);k[i-1][j-1]=0**(abs(f/p-d)<abs(-~f/p-d))
print k

Explanation:
n=input()                                     # obtain size of matrix
k=[n*[0]for x in range(n)]                    # create the n x n 0-filled matrix
for i in range(1,-~n):                        # for every row:
  for j in range(1,-~n):                      # and every column:
    p=1.*i*j                                  # the number of elements 'converted' to float
    f=sum(sum(k[l][:j])for l in range(i))     # calculate the current sum of the submatrix
    d=1./(i+j)                                # calculate the goal average
    k[i-1][j-1]=0**(abs(f/p-d)<abs(-~f/p-d))  # decide whether cell should be 0 or 1
print k                                       # print the final matrix

For those curious, here are some timings:
 20 x  20 took 3 ms.
 50 x  50 took 47 ms.
100 x 100 took 506 ms.
250 x 250 took 15033 ms.
999 x 999 took 3382162 ms.

"Pretty" output for n = 20:
1 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 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 0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 1 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 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 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 0 0 0 0 0
0 0 0 0 0 0 0 1 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 0 0 0 0 0 0

Rust, 152 bytes
|z|{let mut b=vec![];for i in 0..z*z{b.push(((1+i/z)*(1+i%z))as f32/(i/z+i%z+2)as f32>=(0..i).map(|d|(d%z<=i%z&&b[d])as u8 as f32).sum::<f32>()+0.5)};b}

Attempt This Online!
Lots of wasted space due to needing as f32 everywhere :(

Racket 294 bytes
(define(g x y)(if(= 1 x y)1(let*((s(for*/sum((i(range 1(add1 x)))(j(range 1(add1 y)))#:unless(and(= i x)(= j y)))
(g i j)))(a(/ s(* x y)))(b(/(add1 s)(* x y)))(c(/ 1(+ x y))))(if(<(abs(- a c))(abs(- b c)))0 1))))
(for((i(range 1(add1 a))))(for((j(range 1(add1 b))))(print(g i j)))(displayln""))

Ungolfed:
(define(f a b)
  (define (g x y)
    (if (= 1 x y) 1
        (let* ((s (for*/sum ((i (range 1 (add1 x)))
                             (j (range 1 (add1 y)))
                             #:unless (and (= i x) (= j y)))
                    (g i j)))
               (a (/ s (* x y)))
               (b (/ (add1 s) (* x y)))
               (c (/ 1 (+ x y))))
          (if (< (abs(- a c))
                 (abs(- b c)))
              0 1))))
  (for ((i (range 1 (add1 a))))
    (for ((j (range 1 (add1 b))))
      (print (g i j)))
    (displayln ""))
  )

Testing:
(f 8 8)

Output:
10000000
00000100
00100000
00000000
00001000
01000000
00000000
00000000

Perl, 151 + 1 = 152 bytes
Run with the -n flag.  The code will only work correctly every other iteration within the same instance of the program.  To get it to work correctly every time, add 5 bytes by prepending my%m; to the code.
for$b(1..$_){for$c(1..$_){$f=0;for$d(1..$b){$f+=$m{"$d,$_"}/($b*$c)for 1..$c}$g=1/($b+$c);print($m{"$b,$c"}=abs$f-$g>=abs$f+1/($b*$c)-$g?1:_).$"}say""}''

Readable:
for$b(1..$_){
    for$c(1..$_){
        $f=0;
        for$d(1..$b){
            $f+=$m{"$d,$_"}/($b*$c)for 1..$c
        }
        $g=1/($b+$c);
        print($m{"$b,$c"}=abs$f-$g>=abs$f+1/($b*$c)-$g?1:_).$"
    }
    say""
}

Output for input of 100:
[encoded data, 10000 characters]

Wolfram Language (Mathematica), 180 bytes
(a=SparseArray[{1,1}->1,{#,#},-1];({x,y}={##};If[(t=a[[##]])<0,s=0;Do[If[{i,j}!={##},s+=#0[i,j]],{i,#1},{j,#2}];l=s(q=1/x/y)-1/(x+y);r=l+q;a[[##]]=If[Abs@r>Abs@l,0,1],t])&[#,#];a)&

Try it online!
Recursive approach: start from array filled with undefined -1 items and 1 for first item.
For n 20-30 as faster, as Python.
Full version self-explained:
Clear[m];
n = 15;
arr = SparseArray[{1, 1} -> 1, {n, n}, -1];
m[x_, y_] :=
  If[(current = arr[[x, y]]) < 0,

   total = 0; Do[total += m[i, j], {i, x}, {j, If[i == x, y - 1, y]}];
   tmp1 = total/x/y - 1/(x + y); tmp2 = tmp1 + 1/x/y;
   arr[[x, y]] = If[Abs@tmp2 > Abs@tmp1, 0, 1]

   , current
   ];
m[n, n];
StringJoin[Append[#, "\n"] & /@ (Normal@arr /. {1 -> "*", 0 -> " "})]

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


text:
For a given period, getting the smallest list of dates, using jokers
Consider a date formatted in YYYY-MM-DD.
You can use the joker * at the end of the date string. E.g. 2016-07-2* describes all the dates from 2016-07-20 to 2016-07-29.
Now, consider a period represented by a start date and an end date.
The algorithm must find the smallest possible list of dates representing the period.
Let's use an exemple. For the following period:

start date: 2014-11-29
end date: 2016-10-13

The algorithm must return an array containing the following list of dates:

2014-11-29
2014-11-30
2014-12-*
2015-*
2016-0*
2016-10-0*
2016-10-10
2016-10-11
2016-10-12
2016-10-13

The winning objective(s) are ambiguous. I suggest changing it to codegolf (i.e. solve the task in the fewest bytes possible) and always require answers to output the smallest list of dates.

Maybe it's simply not the best site for this, it is more a question (i.e. "I can't find this algorithm in Ruby on Rails") than a challenge "for fun". I'm rather new here...

I suggest you try stackoverflow and then ask it as a question rather than a challenge. If rephrased, the challenge is still interesting in my opinion and deserves a chance (as code golf).

Yeah, I think finding the algorithm is still fun and challenging, but I was not interested in the code-golf side... Well I rephrased it, changed the tags, and now I'm gonna ask stackoverflow while still following this post. Thanks!

Follow-up: I posted on Stackoverflow yesterday, but today I had a working code in Ruby (it doesn't "jokerize" months, but almost there): http://stackoverflow.com/questions/40506639/for-a-given-period-getting-the-smallest-list-of-dates-using-jokers

In your example, could we also return 2014-11-3* instead of 2014-11-30?

Yep, of course.

PHP, 541 343 bytes
I wanted to get the algorithm working in the first place; but golfing it down was actually far more fun than I expected (especially browsing the supported date & time formats).
Three major actions saved about 130 bytes; but the 70 bytes from minor golfings
(which also rendered one of the large steps obsolete) carried a lot of fun.
for($a=($f=strtotime)($argv[1]);!$p=$a>$z=$f($argv[2]);$a+=86400){$x=$z<$e=$f(Dec31,$a);(101<$q=date(md,$a))?$q-1001|$x?:$a=$e+$p="1*":($x?($t=$f(IX30,$a))>$z?:$a=$t+$p="0*":$a=$e+$p="*");$p?:($q%100>1|$z<($t=$f(date(Ymt,$a)))?$q%10>0&$q%100>1|$z<($t=min($t,$a+777600))?:$a=$t+$p="m-$q[2]*":$a=$t+$p="m-*");echo date("Y-".($p?:"m-d"),$a),"
";}

takes input from command line arguments. Run with -nror test it online.
notes

prints Y-m-3* for Y-m-30; add 7 bytes to fix: Insert |$a==$t after 777600)).
throws warnings in PHP 7.1; add 5 bytes to fix: Replace +$p with +!$p.
A breakdown and some golfings explained are ready to be posted;
but I´ll wait a bit to see if someone else submits before I spoil.


text:
Polyglot Anagrams Cops' Thread
This challenge has two threads.  This is the cops' thread. The robbers' thread is located here.
Your challenge is to choose an OEIS sequence and write two full programs in two different languages that produces that nth item in the sequence when given an n via STDIN, or an other forms of standard input, where n is any positive number.  However your two programs must be anagrams, meaning each can be rearranged from the other's letters.
Programs must output the decimal of the number followed by optional whitespace to STDOUT.  Programs may output to STDERR however it should be ignored and if the hidden case does so it must be clearly stated that this is the case.
If you wish you may also output by character code.  However if you do so in your hidden solution you must state such in the body of your submission.
You will then present the OEIS number, the source code for and the name of one language it is in.
Robbers will crack your submission if they find an anagram of the original  submission that runs in a language other than the one you already presented.  To crack an answer they must only find any language and program which produces the sequence and is an anagram of the original, not necessarily the answer the you were thinking about.
Thus you are incentivized to make it as hard as possible to find any language that does the task using their list of symbols.
Scoring
This is code-golf so the shortest un-cracked program is the winner.
Languages
Languages will be considered different if the two proposed solutions do not complete the task in both languages.  This will include different versions of the same language as long as neither the cop's solution or the robber's solution produce the correct output in the other's language.
i.e. If the there are two solutions 1 and 2 that are in language A and B respectively solution 2 must not produce the correct output in language A and solution 1 must not produce the correct output in language B.
Safety
Once your submission has been uncracked for a week you may post your solution and declare your post safe.  If after a week you choose not to post a solution your answer may still be cracked.

To browse through random OEIS sequences for ideas, go to https://oeis.org/webcam

How would it work with languages that like to use flags to the interpreter, such as perl? Are they disqualified? Are flags counted as part of the code? Are flags "free" (not included in code or divulged at all)?

Can the hidden program exit with an error (after producing the output)? Should that be indicated in the answer?

@LuisMendo That is fine but should be indicated.

@Emigna I would like for flags to be divulged if they are not standard flags for running in the language.

Grammar nitpick: "Cop's Thread" and "Robber's Thread" should be "Cops' Thread" and "Robbers' Thread"

@DrMcMoylex Seeing as I have already done that myself, It is certainly allowed I will update the question

I think you should include that in the text

Some reading for writing CnR challenges.

Is it allowed to input/output a character, and use their character code to represent the numbers?

@jimmy23013 No.

@WheatWizard I want to enter a java entry but can people just switch the names of the variables and call it a done deal?

@tuskiomi No they cannot.  The polyglot needs to be in different language.

If the crack doesn't print the exact output, but still a understandable format of the sequence, does it count?

@EasterlyIrk As long as both are proper formats they do not have to be the same

@WheatWizard :/ even if the output formats were known?

@EasterlyIrk what do you mean?

@WheatWizard it was different from the output format of the real crack and the output of the given code.

@EasterlyIrk yes that is still a valid crack

@WheatWizard oh well

Can it be output like [<number>]?

Let us continue this discussion in chat.

My Python submission is correct for the first 15 entries, but loses precision after that. The anagrammed solution has exactly the same problem. Can I keep it, mentioning that it's accurate to 15 terms? (I can't imagine that no other submissions lose precision at some point...)

@ETHproductions I assume that this is a floating point error, so I think that as long as you are specifying that it is looses precision and both solutions would work as intended given infinite floating precision you are ok.

Not sure if this would be helpful to anyone else but this highlights any remaining missing characters or any duplicated ones: http://codepen.io/anon/pen/BQjxRK

It'd be nice if there was a stack snippet to show uncracked answers, oldest first.

Python 2, 118 bytes, A042545 Cracked
i=input();s=1/(801**.5-28);a=[0,1]
for p in range(i):a+=[a[-2]+a[-1]*int(s)];s=1/(s-int(s))
print a[i]#,,,.//000fhlmo|

I didn't feel like implementing a trivial sequence, so I decided to go with my PPCG user ID. I wrote this in the other language first, which should give you a clue about what that language is, though I'd bet 100 dollars that this will be cracked in a golfing language before it's cracked in the intended other language.
Note: Due to floating-point precision errors, this is only accurate up to an input of 14. The intended solution is the same way.
Intended solution, JavaScript (ES7)
for(i=prompt(),s=1/(801**.5-28),a=[1,0];i--;s=1/(s-n))
  n=s|0,a.unshift(a[1]+a[0]*n);
alert(a[0])  //#+2:[]giiiiinnpt

Works in pretty much the same way as the Python solution, though the sequence is stored largest-first rather than smallest-first due to the fact that JS does not support negative indexing.

I can't get the case of A042545(15) to work. OEIS says that it is 53000053, but your program says that it is 27666361 (at least on my machine).

@boboquack The output for 16 is actually 53000053, but after that there doesn't seem to be any matching terms. I wonder why...

Maybe a floating point error that gets progressively worse?

Maybe try codereview.stackexchange.com

Let us continue this discussion in chat.

Cracked.

Dammit, I was right! :( This was as close as I got: https://gist.github.com/dom111/bd9be933cb8ccd0e303601bf73d525b6 Thanks for the workout anyway, I needed |() but just couldn't get them!

Brain-Flak, 24 bytes, A000290, Safe
Yet another square solution. This time there is nothing but parentheses
({(({}[()])()){}[()]}{})

The intended solution was in Brain-Flueue, a version of brain-flak that uses queues instead of stacks.  The program was:
({(({})[()]){}}{})[()()]

The languages are considered distinct because neither of the two programs halt when run in the other language.

This would work in Glypho if input/output using character code is allowed...

@jimmy23013 what is Glypho?

http://esolangs.org/wiki/Glypho ((([{}{}{]]}[)))((){))(}

@WheatWizard If it's cracked, can you edit the answer to show that?

@mbomb007 It is not cracked

@WheatWizard And why isn't jimmy's comment a crack? It works, doesn't it?

@mbomb007 It uses character codes rather than integers.  It does perform the square but does not fit the specs

Outputting a character as a "byte value" is allowed. A brainfuck solution, for example, is allowed to take input as a byte, and output as a byte, even though the output appears as a character. I've done it on challenges before. http://meta.codegolf.stackexchange.com/a/4719/34718

@mbomb007 I have already been very specific about the I/O on this challenge.  While I do respect the consensus of the meta I do not believe that this is a typical challenge.

@jimmy23013 http://meta.codegolf.stackexchange.com/a/4719/34718

@mbomb007 It's understandable to override the default in this challenge. So I asked in a comment to this question. It's better to edit that into the question though.

Also, the spec in the only listed interpreter is different than what the esolangs page says. http://esoteric.voxelperfect.net/files/glypho/doc/glypho.txt

Python 2, 38 bytes, A000290 Cracked by Emigna
def e(X):return X*X
print e(input())##

This will probably be very easy to crack. I'm mostly posting this as a starting point.
Orignial solution in CJam:
ri:XX*e#def ()return X
e#pnt (input())

Cracked

CJam, 7 bytes, A005843 Cracked!
ri2*e#^

This is a basic 2*n sequence.
Explanation:
r          e# read input
 i         e# convert to integer
  2*       e# multiply it by 2
    e#^    e# this is a comment that is ignored by the interpreter

Try it online!

Original Solution, Carrot
#^i*2er

Carrot is an esolang created by me. I have stopped developing it a long time ago. The reason I chose this is because I hoped that it would be hard for other languages to comment out the unnecessary parts of the code.
Explanation:
#^            This pushes the input to the stack (anything before the ^ is the stack)
  i           Convert stack to integer
   *2         Multiply it by 2
     er       These are ignored because they are not Carrot commands
              Implicit output

Try it online!

ri#e^*2 would work in Jelly if * were multiplication instead of exponentiation. So close...

Cracked :).

I had everything but the r in pyth. Exciting to see the original code for this one.

@Emigna I added the original code

Brain-Flak, 44 bytes, A000290 Cracked
<({({})({}[()])}{}))()()()turpentine/"*"*4splint>

Try it online!

Original solution, Python 2
print(input()**(len(set("{}{}{}[]()<>"))/4))

Cracked :)

Now I'm really curious. What was your original intended solution? I can tell it's python because I see len set input and print (and because I know you like python) but I can't figure out how that squares a number

@DrMcMoylex added

2sable, 15 bytes, A000290, Cracked!
Hopping on the same n2 train :p.
*?"!#$&<=@\^{|}

Try it online!

Almost looks like Malbodge with the symbols in order like that :P

Cracked :D

@ConorO'Brien Hahaha, I was pretty certain this wasn't possible in Jelly, Pyth, 05AB1E and MATL. Nice job! :)

Excel, 12 bytes, A000012 Cracked
=IF(1=1,1,1)

Maybe not the toughest, but a fun one to crack.

Cracked

Python 2, 25 bytes, A000583, cracked
Y=input("");print`Y**4`,X

This program exits with an error after printing the output.

My hidden code (substantially different from the cracked solution!):
Actually, 25 bytes
4,n`*`Y")ii(*nppruttY;="X

Try it online!
Explanation:
4,n`*`Y")ii(*nppruttY;="X
4,n                        input, repeat 4 times
   `*`Y                    do * until the stack stops changing (fixed-point combinator)
       ")ii(*nppruttY;="X  push this string and immediately pop and discard it

Cracked

Python 2, 124 bytes, A144945, [Safe]
Cracking this would have earned you a 500 rep bounty! Too late!

Number of ways to place 2 queens on an n X n chessboard so that they attack each other.

I hope it's not too easy. I arranged my code so the whitespace is clearly visible. Those are spaces and newlines only.
Note: intended solution outputs via character code
n=input();print((3+2)*n*n+~0*6*n+1)*n/3;            +6;

+7+7+7+7+7+7+7+7+7;+++++++++++++++9+9*9*9

Try it online
Intended Solution, Headsecks:
r2=ni***p**
(

p((0 ;3+++3;+;/

)

i+++nn
 +)7
n

n+++

17+~
 +)7;97++++7

69+9n+ ++7+n 69
 +7+ ++7

**7+++tut

This is equivalent to the following BF program:
>>,[->>>+>>>+>>>+++++<<<<<<<<<]>>>->>>>>>-<<<[[>+<-]>[>>[<<<+>>+>-]<[>+<-]<-]<<<<]>>+++>[-<-[<+<<]<[+[->+<]<+<<]>>>>>]<<<.,.

Python, 118 bytes, A042545, Safe
i=int(input());s=pow(801.0,0.5);a=[0|0,1]
for Moshprtflmah in range(i):s=1./(s%1);a+=[a[-2]+a[-1]*int(s)];
print(a[i])

This time it works in both 2 and 3. And there's no comments! What will you do?
Note: As with the old solution, this loses precision after the first 15 terms due to floating-point arithmetic errors.
Intended solution, JavaScript (ES6)
giiiiinnnnprt:
i=prompt([n=+2]);s=Math.pow(801,.5);for(a=[1,0];i--;a.unshift(a[1]+a[0]*(s|0)))s=1/(s%1)
alert(a[0])

Though I kept several old versions, I somehow managed to lose this copy, but fortunately piecing it together from the others wasn't too hard. I see now that I had an extraneous prt in both programs that could have been golfed out. Oh well.

I thought I would remind you that you can mark this as safe if you wish.

@WheatWizard Thanks, I've added my intended solution.

Fuzzy Octo Guacamole, 26 bytes, A070627 [Safe]
49++*5^pm#]%:"?:.=:#,|"1:@

Test cases:
1 -> 1
3 -> 23
5 -> 1

Solution:
^::::|*?1=#@]","%.#49++5pm

Works in Magistack.

Hello! Just reminding you that this answer can be marked as safe.  No need to rush but no one has cracked it in a week.  Good job, I am eager to see a solution

Cool, I'll do it and the other once when I get home.

Python 2, 37 bytes, A000290 Cracked
print(input()**(1+1))
"'10°3¢','m'"

Cracked

MATL, 7 bytes, A000217, cracked
:sp{1}x

The sequence is n(n+1)/2 (triangular numbers), starting at input n=1 as specified by the challenge: 1, 3, 6, 10, ... (Output for input 0 is not guaranteed to be the same in the two programs).
The program in the other language exits with an error (after producing the correct output in STDOUT).
Try it online!
:            % Push [1 2 ... n], where n is implicit input
 s           % Sum of that array. Gives the desired result
   p         % Product of that. Gives the same number
    {1}      % Push a cell array containing number 1
       x     % Delete it

Cracked!

@StevenH.Well done! My original solution was x:ps{}1

Fuzzy Octo Guacamole, 11 bytes, A001844 [Safe!]
hha02^d+**+

A crack that sort-of works is dh*h++^2*0a, in Pyth. It's not the right output format though.
My code is still out there! (and it's not in Pyth)
Test Cases:
0 -> 1
1 -> 5

Solution:
^++d0ah*2*h

In Jolf.

I swear, this looks like it was made for Jolf, but I just can't figure out that d...

Cracked (I hope...)

@ETHproductions ah, nice. Not sure if it counts though? See edit.

My code prints a newline, but no space. Same with the valid code.

@EasterlyIrk Despite what I said I do not consider the answer provided a crack.  I everything I said still holds true however I do not consider leading whitespace valid output and I will amend the question to reflect that.

@ETHproductions ^

@WheatWizard OK, I've deleted my post.

This answer can also be marked as safe at your own disgression.

Pyth, 75 bytes, A004526 Cracked, milk
More of a playful test than anything, but:
/Q/////////////////****22222 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2;;;;;

Try it online!
Milk's solution (Convex):
2/Q2 2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2*2*2*; 2*;                 2; 2; 2;

Try it online
Intended solution (///):
/*///;2/;// ///22/Q//2;///;//;***2222222222222222222222

Try it online
Takes input in the form of 2's before the last semicolon and outputs the correct number of Q's.
The sequence is 0-indexed (i.e. 0 is 0, 1 is 0, 2 is 1, ...)
Found slight syntactical mistakes in the ///, so edited all solutions.

Cracked

Python 3, 27 bytes, A000012, Cracked
No input this time!
if 1:
    if 1:
        print( '1' )

The indents are tabs, but not to save bytes - they are required for whitespace.
I don't think it needs a TIO link or explanation!
(Probably won't take long to crack in some way)
Intended answer (Whitespace):
-Start-

    if1:if1:print('1')
-End-

(Start and end not part of the program)
Sorry, I forgot to add that it prints to STDERR:
Try it online!

Cracked.

I feel like this is supposed to be Whitespace, but that would print an error to STDERR as it's lacking the required linefeeds to end in [LF][LF][LF].

@milk Not you again! :D

@boboquack It does work, but it does print to STDERR (which you can see by activating the Debug mode on TIO), and the challenge says that answers need to specify whether the hidden language writes to STDERR.

Cracked again.

@Oliver can't find your crack...

@boboquack I deleted it as it has already been cracked.

MATL, 13 bytes, A002275  Cracked!
i:"@ax'1']
v!

Try it online!
Explanation:
i           % Grab input
 :          % Push (range(1,input))
  "         % For each element in this range:
   @        %   Push it
    a       %   Is is truthy?
     x      %   Delete it
      '1'   %   Push '1'
         ]  %   End loop
v           % Join all of these '1's together
 !          % Transpose and display

I feel like this is in Vim but for the life of me I can't crack it

Cracked :)

WinDbg, 39 bytes, A000007 Cracked by jimmy23013
~e.block{j(0>=@$t0)?@$t0+(1<7);??0}t":"

The difficult sequence of 0**n.
Input is done by passing a value in the pseudo-register $t0.
My original solution was C#:
@t=>(object)(0<@t?0:1)??"$$700~lk.{}+";

Cracked.

JavaScript ES6, 38 bytes, A000290, Cracked
J=>eval(Array(J).fill(J).join`+`)|2-2;

This square train is pretty nifty, but isn't going anywhere fast. (Get it? square train? as in, wheels? no? okay, fine. critics.)

Intended answer: Reticular (Try it online!),
in2Jo;=>eval(Array(J).fill(J).j`+`)|-2
in      take input, convert to number
  2J    raise to the second power
    o;  output and terminate; ignores following chars

Your code is trying to convince me that the other language is J :P

Cracked.

2sable, 13 bytes, A002378, Cracked!
Hoping I didn't miss something. Computes a(n) = n × (n + 1):
>*?"!&)<=@\\}

My version:
?"\>@&*})<\=!

Or the unfolded version:
  ? " \
 > @ & *
} ) < \ =
 ! . . .
  . . .

Note that the > in the top-left corner is unused (except for the 2sable program). I did this to confuse the robbers (but that obviously didn't work haha).
Try it online!

Cracked. :)

@MartinEnder Nice job! I'll update my answer with the original submission :).

Python 2, 35 bytes, A048735, Safe
print(lambda u:u&u<<1)(input())>>1

The original solution was in my own programming language Wise.
:<<>&>print(lambda uuu1)(input())1

Most of the characters are irrelevant no-ops.  The important characters are the first six. : creates two copies of the first item on the stack.  <<> bit shifts twice to the left and once to the right which is equivalent to bit shifting once to the left.  & takes the bitwise and of the top and second item (the original and the bit shifted copy).  Lastly > bit shifts once to the right.

05AB1E, 5 bytes, A000012, Safe
$;$1?

Sequence of 1's. Try it online
Intended Solution: Arcyou
1;$$?

Try it online. I couldn't find documentation for this language, so don't have an explanation of how it works exactly.

Stupid semicolon... I could almost use Retina, but I can't have both the 1 and ;.

This has not been cracked

It looks like this answer can now be marked as safe.  Since I spent quite a deal of time trying to crack this one I am quite eager to see the intended answer.

Shouldn't this answer be marked as "accepted" now?

 Befunge 93, 14 bytes, A121377,  Cracked by milk!
&52* %68*+ .@Q

Fun fact: The intended solution to this is the first time I've ever used that language.
My solution in Pyth. &@ print an error, but that goes to STDERR which according to the OP is ignored.
+%Q*5 2*6 8.&@

Cracked

2sable, 15 bytes, A087156
D1QiA0*<}.;2->>

Try it online
The sequence of non-negative numbers, except for 1.

Python 2, 70 Bytes, A000217 Cracked!
I have a feeling this won't be cracked in the language I used for the other version, we will see :)
o=input()
v=0
i=1
while o:
 v+=i
 i+=1
print v

#|  d00->1@@@++-^,,[

I realized afterwards I had incorrectly obfuscated the code (it doesn't change the posted answer's validity). Here's the code I started with in Haystack:
v
0
v
0
i
1
-
>      d0[v
^-1@+@d+1@?,,o|

Cracked.

05AB1E, 9 bytes, A000042 Cracked!
1×,1*-^$)

This is the Unary representation of natural numbers (OEIS). So if the input was 3, for example, then output would be 111.
Explanation:
                    # implicit input
1                   # pushes 1 to the stack
 ×                  # pushes "1" × (the input)
  ,                 # outputs the stack
   1*-^$)           # irrelevant

Try it online!

Original Solution, Carrot
1^*$-1×^)

Explanation
1^             Push "1" to the stack
  *            Multiply the string by
   $-1         ...the input (as an integer) minus 1 times
      ×,)      Ignored by the interpreter

The * multiplies the string by (n+1) times, so that a^*3 results in aaaa and not aaa. So that is why I subtracted 1 from the input.
Only now I realise that the ) has been irrelevant in both the languages :D
Try it online!

Cracked.

What was the original hidden language?

@WheatWizard Whoops, thanks for finding that. I added the language now

05AB1E, 8 bytes, A000042, Cracked
F1}J,(1&

Test cases:
1 -> 1
2 -> 11
3 -> 111

Cracked

J, 2 bytes, A000290, Cracked
*~

Well, might as well start going for those two-byters. Yields n × n, or n2.
intended solution, Jolf, 2 bytes
*~

Well. Yeah. This is my own language and I think it works because ~ looks for an extended character, but doesn't find one, so it just ignores it. ¯\_(ツ)_/¯ Oops.

Cracked!

@StevenH. nice job! I edited with intended solution.

@ConorO'Brien your intended solution was not a valid solution.  In order for languages to be considered distinct neither the original or the solution can be a polyglot in both languages

@WheatWizard Oh. That's awkward.

ABCR, 24 bytes, A023443 Cracked!
70: Quit xi. Classy queue!

There's a bunch of no-ops.  Calculates n - 1.

Ouroboros, 6 bytes, A000012 Cracked
)49.o(

Always outputs 1.

Cracked.

@DLosc sorry for posting in the wrong place but you haven't been on chat in ages ;_;

05AB1E, 5 bytes, A005843
ApDF>

Calculates n*2.

This is NOT cracked because I just found out that my crack was invalid. I have deleted it now because it is invalid since the original program was a polyglot in 05AB1E/2sable.

05AB1E, 5 bytes, A000012 Cracked!
¸WW/`

The funny thing is that the cracked version is the intended answer.
Try it online!

It outputs nothing when the input is 0

And it outputs 21 when input is 42 Here

@KritixiLithos There.

Now it outputs 1.0 instead of 1

@KritixiLithos It's the same thing.

Cracked! :)


text:
Polyglot Anagrams Robbers' Thread
This is the robbers' thread of this challenge
The cops will choose an OEIS sequence and write two full programs in two different languages that produces that nth item in the sequence when given an n via STDIN.  The two programs must be anagrams of each other, meaning each can be rearranged from the other's letters.
They will present the OEIS number, the source code for and the name of one language it is in.
You must find an anagram of the original cop's submission that runs in a language other than the one used by the cop.  To crack an answer you must only find any language and program which produces the sequence and is an anagram of the original, not necessarily the answer the cop was thinking about.
You may output by character code or include STDERR in your solution, but only if the cop has indicated their hidden solution does so.  Decimal output to STDOUT is always a valid crack.
Thus cops are incentivized to make it as hard as possible to find any language that does the task using their list of symbols.
Scoring
The person with the most cracks will be the winner of this section.  Only the first crack for each solution will count towards one's score.
Leader Board
Big thanks to every one that took place in this challenge.
Here is the leader board as it stands
Place  User             Score
-----------------------------
1      Adnan            3
1      Kritixi Lithos   3
1      Emigna           3
1      milk             3
5      Steven H.        2
5      Wheat Wizard     2
5      jimmy23013       2
8      ETH Productions  1
8      Dennis           1
8      alleks           1
8      Martin Ender     1
8      Oliver           1
8      Conor O'Brien    1

Not sure I understand the "anagram" part, could you elaborate a bit?

@TheBitByte The other solution has to use all of the same characters as the original but rearranged in a different order.

Without any additional characters?

@TheBitByte yes and without removing any characters

05AB1E, 38 bytes, Loovjo, A000290
nXtdief e():return X*X
pr e(input())##

Try it online!
Very likely not the intended solution, but it works.
Explanation
n      # square input
 X     # push 1
  t    # push sqrt(1)
   d   # push is_number(1.0)
    i  # if true do the rest of the code (1.0 is not a number so it will never execute)

1.0 is not a number? Could you please elaborate?

@ETHproductions: the function is_number checks that the number only consist of 0-9. As . is not a number, it becomes false. The function could use a more descriptive name :)

Jolf, 15 bytes, Adnan, A000290
*&"?!#$|<=@\^{}

Try it here! Definitely not the intended solution, but hey, it works.
Explanation
*&"?!#$|<=@\^{}
*                multiply
 &               the two inputs to this func, x, y: x && y
                 returns y if x and y, or the falsey argument.
  "?!#$|<=@\^{}  this string is always truthy, so the second arg is used.
                 two implicit inputs are taken, both equal to the first arg
                 so, this corresponds to *xx, which is x^2.

05AB1E, 49 bytes, Wheat Wizard, A000290
Actually the same approach as Emigna's crack :p.
n4i<({({)({[()]){))()()()turpetne/"*"*splint>}}}}

Explanation:
n          # Square the input
 4i        # If 4 == 1, do the following...
   <({...

Try it online!

Not the solution I was looking for but +1 anyway

05AB1E, 35 bytes, Oliver, A000290
Cops should stop posting n^2 challenges in python...
n0iprt(input()**(1+1))
"'1°3¢','m'"

Try it online!
Explanation
n    # square input
 0i  # if 0 == 1 do the rest of the code

2sable, 7 bytes, Kritixi Lithos, A005843
Code:
r^#ei2*

Explanation:
r         # Reverse the stack, which is a no-op
 ^        # XOR the input with itself, always leading to 0
  #       # If 1, break (which stops the program)
   e      # Compute input nPr input, which always leads to 1
    i     # If equal to one, do the following..
     2*   #   Multiply the input by 2.

Try it online!

It's wonderful how the actual code is only 2 bytes!

Hexagony, 13 bytes, Adnan, A002378
?"&\>=})\*!@<

Try it online!
Unfolded:
  ? " &
 \ > = }
) \ * ! @
 < . . .
  . . .

Not 100% whether this is the original, because the top left \ is unused.
The <\> are just mirrors, so the program is actually entirely linear:
?"&)}=*!@

?          Read input.
 "         Move back and left.
  &        Copy input.
   )       Increment copy.
    }=     Move forward and right and turn around (to face the n and n+1 edges).
      *    Multiply.
       !   Print.
        @  Terminate.

V, 13 bytes, DJMcMayhem, A002275
v!:x]''"
@ai1

Try it online!
This might be the first solution in the language the author intended.

Explanation
v!:x]''"   Does nothing
@ai1       inserts 1 a times

Perhaps you should let DJMcMayhem know you cracked it? ;)

@ETHproductions I told him in chat I will probably tell him again in comments.

This might be the first solution in the language the author intended. Spot on. :)

2sable, Conor O'Brien, A000290
~*

Try it online!
I don't know how it works, there's really only one program that meets the requirements and I just brute-forced to find the language it worked in.
After looking through the docs, I am able to come up with an explanation:
~         Push Input OR Input (always pushes the input)
 *        Multiply that by Input

Pyth, 26 bytes, Steven H., A023443
Code:
tQ.qly 7:esau0euii s uxC !

Try online.
Fairly simple:
 Q                            Reads input
t                             Substracts 1 from it
  .q                          Quits program (implicit print)
    ly 7:esau0euii s uxC !    None of this ever plays a part...
                                I just thought it'd be fun to scramble it.

Intended solution! (minus the scrambling, of course.)

That's awesome! Nice idea.
Sorry about not letting you know directly... Too little rep.

No problem! Congrats.

Python 3, 118 bytes, ETHproductions, A042545
s,a=801**.5-28,[0,0==0]
for i in range(int(input())):a+=[a[i]+a[-1]*int(1/s)];s=1/s-1//s
(print(a[-2]),) #.0fhlmop|

Test it on Ideone.
Cop submission
i=input();s=1/(801**.5-28);a=[0,1]
for p in range(i):a+=[a[-2]+a[-1]*int(s)];s=1/(s-int(s))
print a[i]#,,,.//000fhlmo|

What's different
The cop submission doesn't work in Python 3 for two reasons.

Python 2's input function automatically evals one line of input, while Python 3's counterpart just returns the line as a string. We can simply call int to fix this.
print was a statement in Python 2, but it is a function in Python 3. In particular, that means that we have to surround its argument with parentheses.

That means we need int() and (), but those characters aren't all part of the comment. That means we must make some changes.
Instead of the fraction s, we keep track of 1/s.
The initialization of s – s=1/(801**.5-28) – becomes s=801**.5-28, saving the characters 1/().
The factor of a[-1] in the update of a – int(s) – becomes int(1/s), costing the characters 1/.
The update of s – s=1/(s-int(s)) – becomes s=1/s-1//s, costing the characters 1//, but saving the characters (int()).
The saved characters in ()(int()) cover those we needed to port the code to Python 3, but obtaining them cost us 1//. We can take // from the comment, but we'll have to save 1 elsewhere.
One way (the only one?) of saving the needed 1 is to replace the 1 in the initialization of a with 0==0. This costs those four characters, but we can take 00 from the comment.
So far, we have the following code.
i=int(input());s=801**.5-28;a=[0,0==0]
for p in range(i):a+=[a[-2]+a[-1]*int(1/s)];s=1/s-1//s
print(a[i]) #,,,.()0fhlmo|

To recover one of the = we now "owe", we can rewrite the initialization of s and a with a single assignment: s,a=801**.5-28,[0,0==0] Additionally, this saves a ; and costs a ,, which can be be added to and removed from the comment.
The second = can be saved by not storing the input in a variable, i.e., writing range(int(input())) instead, saving the characters in i=. We use i after the loop as well, but the ith element of a is just the second one from the right, so we can replace i with -2. For the same reason, a[-2] in the loop body can be replaced with i.
We now have a permutation into working Python 3 code:
s,a=801**.5-28,[0,0==0]
for i in range(int(input())):a+=[a[i]+a[-1]*int(1/s)];s=1/s-1//s
print(a[-2]) #,.()0fhlmop|

However, this code also works in Python 2! One way of fixing this is to replace print(a[-2]) with (print(a[-2]),); we have the characters we need in the comment. As mentioned before, print is a function in Python 3, so this constructs the tuple (None,). However, Python 2's print statement is a SyntaxError inside a tuple literal.

Dang, nice... maybe I should've spent a little more time writing a comment-less version. I'll post my intended solution.

I've created a modified version of my program that works in both Python 2 and 3, uses no comments, and has a very different (intended) solution. Is it worth posting as a separate answer?

If it works in both Python 2 and 3, it's not a valid solution. The crack cannot work in the original language.

I don't understand. The intended crack isn't in Python.

Oh, you mean a new cop submission. I thought we were talking about a different crack to this one... Sure, go ahead and post it.

Yeah, sorry for the misunderstanding.

CJam, 39 bytes, milk, A000007
l~0{"e.bockj(>=@$t0)@$t0+(<7)??0t:"};1?

Try it here.

Pyth, 7 bytes, Luis Mendo, A000217
x:{ps}1

As requested, the program exits with error after printing the correct answer.
Try it online here!

05AB1E, 12 bytes, tuskiomi, A000012
1,(FI1=1=1,)

Try it online!
Explanation
1,            # print 1
  (           # negate input
   F          # that many times do (i.e. no times)
    I1=1=1,)  # the rest of the code

Funny. I didn't have a 2nd program for this, because I didn't understand what cops and robbers was (whoops). good job being inventive!

05AB1E, 38 bytes, Conor O'Brien, A000290
n2iJ=>eval(Array(J).fill(J).jo`+`)|-2;

Try it Online!

Explanation
This is based on Emigna's crack here.
n   #Squares the number
 2i #Runs the rest of the code if 2==1

I've edited my answer with the intended solution. nice job! I'll have to rethink my approach...

05AB1E, 27 bytes, boboquack, A000012
1 1pif:
    if :
        rint( '1' )

Try it online
How it works:
1                     # push 1
  1                   # push 1
   p                  # pop (1), push is_prime(1)
    i                 # pop (is_prime(1), false), if is false so don't execute rest

CJam, 70 bytes, Shebang, A000217
ri),:+

e#|  d00->1@@@++-^,[o=input(v=0i=1whil o v=i i+=1pnt v

Try it here.

I was afraid of the CJam solution ;)

Convex, 75 bytes, boboquack, A004526
2/Q2 2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2*2*2*; 2*;                 2; 2; 2;

Try it online
How it works:
2  e# push 2
 / e# pop first 2, divide, push result
   e# push a bunch of garbage but discard it all with semi-colons (;)
  Q2 2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2*2*2*; 2*;                 2; 2; 2;

Dip, 9 bytes, Kritixi Lithos
Definitely not the intended answer.
1^,-$)×1*

Explanation:
1$^,-)×   # Basically does nothing
       1* # Repeat "1" n times

Now all that's left for me is to crack your A000042 answer too!

Pip, 6 bytes, DLosc, A000012
.()49o

I figured I'd try the OP's esolang first ;-)
Try it online.

I was actually curious to see if there were a different one where it would work. :) But good job.

05AB1E, 25 bytes, Mego, A000583
Code:
nnYi=put("");prit`Y**4`,X

Explanation:
n       # Square the input
 n      # Square the squared input
  Y     # Constant that pushes 2
   i    # If equal to 1, do the following:
    =put...

Try it online!

Oh come on, You beat me by 12 seconds :)

@Emigna The time between the answers is uncanny :p.

It didn't register the first time I pressed post either, so they would have been almost instantaneous :)

Dip, 8 bytes, Oliver, A000042
(1J&F},1

Explanation
              #Implicit Input
(             #Start range loop
 1            #Push 1 to the stack
  J           #Join all the elements in the stack
   &          #End program
    F},1      #These are ignored

The funny thing is that this was the intended language! Dip is an esolang created by Oliver.
Test Cases and Running Dip from Command-Line
$python3 dip.py
Dip v1.0.0 by Oliver Ni.
>>> (1J&F},1
> 4
1111
>>> (1J&F},1
> 7
1111111

05AB1E, 4 bytes, Oliver, A000012
p¥_1

Try it online!
This is a sequence of 1s.
              # Implicit input
p¥_           # Does nothing
   1          # Pushes 1 to the stack
              # Implicit output

This outputs 1 no matter what the input is.

2sable, 14 bytes, Dopapp, A121377
Q@5 2*%6 8*+.&

Try it online.
How it works (more or less):
Q@
  5              # Push 5
    2            # Push 2
     *           # Pop (2), pop (5), push 5*2=10
      %          # Pop (10), pop (input), push input%10
       6         # Push 6
         8       # Push 8
          *      # Pop (8), pop (6), push 8*6=48
           +     # Pop (48), pop (input), push input+48
            .&

Dip, 5 bytes, Oliver, A000012
`¸WW/

The sequence just prints a 1 no matter what the input is. Oliver's answer prints
a 1.0. This program also prints a 1.0. This apparently is the intended solution.
Explanation
`¸                  # push character `¸`
  W                 # pushes 1000000
   W                # pushes 1000000 also
    /               # divides the last two items in stack resulting in 1.0
                    # implicit output (1.0)

Alternative solution (courtesy of @milk)
Convex, 5 bytes
WW¸`/

Try it online!
Explanation
                  // implicit input
W                 // pushes -1
 W                // pushes -1 also
  ¸               // calculates the LCM of the two numbers (which evaluates to 1)
   `              // finds its string representation
    /             // slices the string (so that it would evaluate to "1")
                  // implicit output

Alternate crack in Convex: WW¸`/

@milk Thanks! I added it in my latest edit

Your Convex program kinda doesn't work as you think it does. As of right now, it pushes -1 twice, LCMs them (which would be 1), finds the string representation, and finally slices the string (which would be "1") by every [input] characters (since the input is a number.

@GamrCorps How's it now?


text:
Find the Emirps!

An emirp is a non-palindromic prime which, when reversed, is also prime.

The list of base 10 emirps can be found on OEIS. The first six are:
13, 17, 31, 37, 71, 73

However, due to the reversal rule, emirps are different in each base. For example, the first six binary emirps are:
Bin  | 1011, 1101, 10111, 11101, 101001, 100101
Dec  | (11 , 13  , 23   , 29   , 37    , 41   )

...and in hexadecimal, they are:
Hex |  17, 1F, 35, 3B, 3D, 53
Dec | (23, 31, 53, 59, 61, 83)

Fun Fact: there are no emirps in unary as every number is a palindrome.

The Challenge
Your task is to create a function (or full program) which takes two parameters,
\$ n \$ and \$ b \$, and generates a list of the first \$ n \$ emirps in base \$ b \$.
Rules/Details:

\$ n \$ and \$ b \$ are both positive integers larger than \$ 0 \$.
You can assume \$ 2 ≤ b ≤ 16 \$: that is to say, the base will be between binary and hexidecimal.
You should be able to compute for values of \$ n \$ up to \$ ~100 \$.
The generated list can be in base \$ b \$, or your language's standard integer base, as long as you specify this in your answer.
Builtin emirp checks are not permitted (builtin primality tests are fine)
You cannot hard-code the emirps, or read from any external files.
Standard loopholes are banned, as always.
This is code-golf, so the shortest answer (in bytes) wins.

Test Cases
For each test case, I've included the list in base b and its base 10 equivalents.
B = 2, N = 10

BIN: [1011, 1101, 10111, 11101, 100101, 101001, 101011, 101111, 110101, 111101]
DEC: [11, 13, 23, 29, 37, 41, 43, 47, 53, 61]

B = 3, N = 5

BASE3: [12, 21, 102, 201, 1011]
DEC:   [5, 7, 11, 19, 31]

B = 12, N = 7

BASE12: [15, 51, 57, 5B, 75, B5, 107]
DEC: [17, 61, 67, 71, 89, 137, 151]

B = 16, N = 4

HEX: [17, 1F, 35, 3B]
DEC: [23, 31, 53, 59]

You can test your program further against my (ungolfed) Python example on repl.it

Jelly, 16 bytes
bµU,ḅ⁹QÆPḄ=3
⁸ç#

TryItOnline!
How?
bµU,ḅ⁹QÆPḄ=3 - Link 1, in-sequence test: n, b
b            - convert n to base b - a list
 µ           - monadic chain separation
  U          - reverse the list
   ,         - pair with the list
     ⁹       - link's right argument, b
    ḅ        - convert each of the two lists from base b
      Q      - get unique values (if palindromic a list of only one item)
       ÆP    - test if prime(s) - 1 if prime, 0 if not
         Ḅ   - convert to binary
          =3 - equal to 3? (i.e. [reverse is prime, forward is prime]=[1,1])

⁸ç# - Main link: b, N
  # - count up from b *see note, and find the first N matches (n=b, n=b+1, ...) for:
 ç  - last link (1) as a dyad with left argument n and right argument
⁸   - left argument, b

* Note b in base b is [1,0], which when reversed is [0,1] which is 1, which is not prime; anything less than b is one digit in base b and hence palindromic.

05AB1E, 17 bytes
Uses CP-1252 encoding.
Input order is n, b
Output is in base-10.
µN²BÂD²öpŠÊNpPD–½

Try it online!
Explanation
                    # implicit input a,b
µ                   # loop until counter is a
 N²B                # convert current iteration number to base b
    ÂD              # create 2 reversed copies
      ²ö            # convert one reversed copy to base 10
        p           # check for primality
         ŠÊ         # compare the normal and reversed number in base b for inequality
           Np       # check current iteration number for primality
             P      # product of all
              D     # duplicate
               –    # if 1, print current iteration number
                ½   # if 1, increase counter

You can drop the trailing ½, since it's done implicitly (not sure if this was already the case when you posted this answer, probably not).

Mathematica, 70 bytes
Cases[Prime@Range@437,p_/;(r=p~IntegerReverse~#2)!=p&&PrimeQ@r]~Take~#&

Works for 0 <= n <= 100 and 2 <= b <= 16. From the list Prime@Range@437 of the first 437 primes, find the Cases pwhere the IntegerReverse r of p in base #2 is not equal to p and is also prime, then take the first # such p.
Here's a 95 byte solution that works for arbitrary n>=0 and b>=2:
(For[i=1;a={},Length@a<#,If[(r=IntegerReverse[p=Prime@i,#2])!=p&&PrimeQ@r,a~AppendTo~p],i++];a)&

+1 IntegerReverse.  Of course! Nice.

79 bytes for the arbitrary-n-b solution; 77 bytes if Reaping is allowed in the footer: For[i=j=0,j<#,If[(r=IntegerReverse[p=Prime@++i,#2])!=p&&PrimeQ@r,j++;Sow@p]]&

Perl, 262 bytes
($b,$n)=@ARGV;$,=',';sub c{my$z;for($_=pop;$_;$z=(0..9,a..z)[$_%$b].$z,$_=($_-$_%$b)/$b){};$z}sub d{my$z;for(;c(++$z)ne@_[0];){}$z}for($p=2;@a<$n;$p++){$r=qr/^1?$|^(11+?)\1+$/;(c($p)eq reverse c$p)||((1x$p)=~$r)||(1x d($x=reverse c($p)))=~$r?1:push@a,c($p);}say@a

Readable:
($b,$n)=@ARGV;
$,=',';
sub c{
    my$z;
    for($_=pop;$_;$z=(0..9,a..z)[$_%$b].$z,$_=($_-$_%$b)/$b){};
    $z
}
sub d{
    my$z;
    for(;c(++$z)ne@_[0];){}
    $z
}
for($p=2;@a<$n;$p++){
    $r=qr/^1?$|^(11+?)\1+$/;
    (c($p)eq reverse c$p)||((1x$p)=~$r)||(1x d($x=reverse c($p)))=~$r?1:push@a,c($p)
}
say@a

c converts a given number into base $b, and d converts a given number from base $b back into decimal by finding the first number which returns said base-$b number when passed to c.  The for loop then checks if it's a palindrome and if both of the numbers are prime using the composite regex.

Mathematica 112 bytes
Cases[Table[Prime@n~IntegerDigits~#2,{n,500}],x_/;x!=(z=Reverse@x)&&PrimeQ[z~(f=FromDigits)~#2]:>x~f~#2]~Take~#&

Example
Find the first 10 Emips in hex; return them in decimal.
Cases[Table[Prime@n~IntegerDigits~#2, {n, 500}],
x_ /; x != (z = Reverse@x) && PrimeQ[z~(f = FromDigits)~#2] :> x~f~#2]~Take~# &[10, 16]

{23, 31, 53, 59, 61, 83, 89, 113, 149, 179}

Ungolfed
Take[Cases[                                             (* take #1 cases; #1 is the first input argument *)
   Table[IntegerDigits[Prime[n], #2], {n, 500}],        (* from a list of the first 500 primes, each displayed as a list of digits in base #2 [second argument] *)
   x_ /;                                                (* x, a list of digits, such that *)
   x != (z = Reverse[x]) && PrimeQ[FromDigits[z, #2]]   (* the reverse of the digits is not the same as the list of digits; and the reverse list, when composed, also constitutes a prime *)
   :> FromDigits[x, #2]],                               (* and return the prime *)
   #1] &                                                (* [this is where #1 goes, stating how many cases to Take] *)

Perl 6, 91 bytes
->\n,\b{(grep {.is-prime&&{$_ ne.flip &&.parse-base(b).is-prime}(.base(b).flip)},1..*)[^n]}

Returns the list of emirps in base 10.

81 bytes

C, 293 286 261 bytes
Improved by @ceilingcat, 261 bytes:
v,t,i,j,c,g,s[9],r[9],b;main(n,a)int**a;{for(b=n=atoi(a[1]);g^atoi(a[2]);t|v|!wcscmp(s,r)||printf("%u ",n,++g)){i=j=0;for(c=++n;s[i]=c;c/=b)s[i++]=c%b+1;for(;r[j]=i;)r[j++]=s[--i];p(n);for(t=v;r[i];)c+=~-r[i]*pow(b,i++);p(c);}}p(n){for(j=1,v=0;++j<n;n%j||v++);}

Try it online!
(This person is like constantly following me around PPCG and improving my stuff in the comments, and as soon as I reply to thank him he just deletes the comment and vanishes lol. Welp, thanks again!)

Improved by @movatica, 286 bytes:
u,v,t,i,j,c,n,g;main(int x,char**a){char s[9],r[9],b=n=atoi(a[1]);x=atoi(a[2]);for(;g^x;){i=j=0;for(c=++n;c;c/=b)s[i++]=c%b+1;s[i]=c=0;for(;i;r[j++]=s[--i]);r[j]=0;p(n);t=v;for(;r[i];)c+=(r[i]-1)*pow(b,i++);p(c);t|v|!strcmp(s,r)?:printf("%u ",n,++g);}}p(n){for(u=1,v=0;++u<n;n%u?:v++);}

Try it online!

My original answer, 293 bytes:
u,v,t,i,j,c,n,g;main(int x,char**a){char s[9],r[9],b=n=atoi(a[1]);x=atoi(a[2]);for(++n;g^x;++n){i=j=0;for(c=n;c;c/=b)s[i++]=c%b+1;s[i]=c=0;for(;i;r[j++]=s[--i]);r[j]=0;p(n);t=v;for(--i;r[++i];)c+=(r[i]-1)*pow(b,i);p(c);t|v|!strcmp(s,r)?:printf("%u ",n,++g);}}p(n){for(u=1,v=0;++u<n;n%u?:v++);}

Compile with gcc emirp.c -o emirp -lm and run with ./emirp <b> <n>. Prints space-separated emirps in base-10.

@FlipTack You're right. I'll have to fix it tomorrow.

@FlipTack Fixed and tested to make sure it passes your tests. Is this good?

Sure is! And welcome to code golf.

Nice work! I moved some increment operators to get you down to 286

@movatica Awesome! I added your improvements to my answer. Thanks!

Suggest s[i]=c?c%b+1:0;c/=b)i++; instead of s[i]=c;c/=b)s[i++]=c%b+1; and r[j++]=i?s[--i]:0;); instead of r[j]=i;)r[j++]=s[--i];

Python 3, 232 214 191 188 bytes

Herman L -14 bytes
Jo King -3 bytes

p=lambda n:all(n%i for i in range(2,n))
def f(b,n):
 s=lambda n:(''if n<b else s(n//b))+f'{n%b:X}';l=[];i=3
 while n:i+=1;c=s(i);d=c[::-1];a=(c!=d)*p(i)*p(int(d,b));l+=[c]*a;n-=a
 return l

Try it online!

200 bytes

Nice catch! Brought that down to 191 bytes

JavaScript (ES6), 149 148 141 140 bytes
Returns a space-separated list of emirps in base b. (Could be 2 bytes shorter by returning a decimal list instead.)
f=(b,n,i=2)=>n?((p=(n,k=n)=>--k<2?k:n%k&&p(n,k))(i)&p(k=parseInt([...j=i.toString(b)].reverse().join``,b))&&k-i&&n--?j+' ':'')+f(b,n,i+1):''

Test cases

f=(b,n,i=2)=>n?((p=(n,k=n)=>--k<2?k:n%k&&p(n,k))(i)&p(k=parseInt([...j=i.toString(b)].reverse().join``,b))&&k-i&&n--?j+' ':'')+f(b,n,i+1):''

console.log(f(2,10));
console.log(f(3,5));
console.log(f(12,7));
console.log(f(16,4));

Python 2, 133 bytes
p=lambda n:all(n%i for i in range(2,n))
b,n=input()
i=b
while n:
 j=i=i+1;r=0
 while j:r=r*b+j%b;j/=b
 if(i-r)*p(i)*p(r):print i;n-=1

Try it online!
Outputs each number on a new line, in base 10

Husk, 20  17 bytes
↑fo§&ȯṗB⁰↔S≠↔B⁰İp

Try it online!
The type inference is odd here.
-3 bytes from Jo King.

APL(NARS), 87 chars, 174 bytes
r←a f w;i
i←1⋄r←⍬
→2×⍳∼{∼0π⍵:0⋄k≡v←⌽k←{(a⍴⍨⌊1+a⍟⍵)⊤⍵}⍵:0⋄0πa⊥v:1⋄0}i+←1⋄r←r,i⋄→2×⍳w>≢r

The result will be in base 10. Test and results:
  3 f 1
5
  2 f 10
11 13 23 29 37 41 43 47 53 61
  3 f 5
5 7 11 19 31
  12 f 7
17 61 67 71 89 137 151
  16 f 4
23 31 53 59

{(⍺⍴⍨⌊1+⍺⍟⍵)⊤⍵} would do conversion of ⍵ in base ⍺, array integer result; 0π⍵ would return true[1] if ⍵ is prime else it would return 0.

Japt, 18 bytes
With decimal output.
È2¶[XXìV'w]â xj}jU

Try it

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


text:
Determine the optimal cruise control options
A cruise control has 3 different options to move the handle to set the speed you want to drive with.

Towards you: Adds 1 speed.
Upwards: Increases speed to the next multiple of 10 (e.g. 20-->30, 32-->40)
Downwards: Decreases speed to the next multiple of 10 (e.g. 20-->10, 32-->30)

Input

2 integers: the first is the starting speed and the second is your desired speed, both non-negative and in any form you like (array, two arguments, etc.)

Task

Determine the optimal way of using the handle to reach the desired speed and print out the moves in the correct order.

Rules

If you have the choice between pulling towards you and going upwards (like from 39 to 40) you can choose either option, but stay with whatever you choose for similar cases
You may use any 3 different (preferably visible) symbols to distinguish between the moves in the output (T, U and D for example).
The symbols can be seperated by new lines, spaces, etc. but don't have to be

Here are some test cases:
start speed, desired speed  -->  output
30, 40  -->  U
30, 43  -->  UTTT
43, 30  -->  DD
51, 39  -->  DDDTTTTTTTTT
29, 30  -->  T or U
29, 50  -->  TUU or UUU
12, 12  -->

This is code-golf so the shortest answer in bytes wins.

For anyone who wondered, today I noticed my cruise control has actually a "hidden" button to decrease the speed by 1. I was driving wrong the entire time...

JavaScript (ES6), 91 84 75 bytes
Saved 4 bytes thanks to @Neil
f=(s,d)=>s-d?(q=s+10-s%10)>d?s>d?0+f(s-(s%10||10),d):1+f(s+1,d):2+f(q,d):""

Uses 0 for D, 1 for T, and 2 for U.

(s/10+1|0)*10 == (s/10|0)*10+10 == s-s%10+10.

@Neil Thanks, that helps in another spot too!

You broke f(37,43) which was 2111 but your new code returns 111111.

@Neil Fixed at a cost of 2 bytes.

Java, 144 139
Saved 5 bytes thanks to Kevin.
void o(int s,int e){int t=10,x=s/t;System.out.print(s>e?"D":s<e?x<e/t?"U":"T":"");if(s!=e)o(s>e?x*t-(s%t<1?t:0):s<e?x<e/t?(x+1)*t:s+1:0,e);

Ungolfed
public static void optimalCruise(int start, int end){

    if(start > end) {
        System.out.print("D");
        optimalCruise(start/10*10-(start%10<1?10:0), end);
    } else if(start < end){
        if(start/10 < end/10){
            System.out.print("U");
            optimalCruise(((start/10)+1)*10, end);
        } else {
            System.out.print("T");
            optimalCruise(start+1, end);
        }
    }
}

By making two int variables for 10 and s/10 you can shorten it by 5 bytes: void o(int s,int e){int t=10,x=s/t;System.out.print(s>e?"D":s<e?x<e/t?"U":"T":"");if(s!=e)o(s>e?x*t-(s%t<1?t:0):s<e?x<e/t?(x+1)*t:s+1:0,e);

@KevinCruijssen good catch, I'll edit it in

Batch, 175 bytes
@set/as=%1,d=%2,e=d/10*10
:d
@if %s% gtr %d% echo d&set/as=~-s/10*10&goto d
:u
@if %s% lss %e% echo u&set/as=s/10*10+10&goto u
:t
@if %s% neq %d% echo t&set/as+=1&goto t

Fairly straightforward this time. Takes input as command-line parameters, which it saves into s and d. e is d rounded down to the previous multiple of 10. If s is greater than d, then we obviously need to invoke d until s becomes lower than d. Otherwise, we need to check whether s is lower than e; if so, we can invoke u until s equals e. At this point s is now between e and d and we can simply invoke t until we reach d. I looked into for loops but they use inclusive endpoints so would have become too verbose.

Python, 76 bytes
lambda a,b: "U"*(b//10-a//10)+"D"*(a//10-b//10+(b<a))+"T"*min(b%10,(b-a)%99)

min(b%10,(b-a)%99) wont always work, for example (a,b)=(132,33)

You have an extra space after b:

C, 156 bytes
t,x,y;main(int s,char**a){x=(s=atoi(a[1]))/10,y=(t=atoi(a[2]))/10;if(s^t){for(;y>x;++x)puts("U");for(x+=(s-t>10);x>y;--x)puts("D");for(;t--%10;)puts("T");}}

Ungolfed:
#include <stdio.h>
#include <stdlib.h>
int t, x, y;
int main(int s, char **a)
{
    x = (s = atoi(a[1])) / 10,
    y = (t = atoi(a[2])) / 10;

    if (s ^ t) {
        for ( ; y > x; ++x)
            puts("U");

        for (x += (s - t > 10) ; x > y; --x)
            puts("D");

        for ( ; t-- % 10; )
            puts("T");
    }
    return 0;
}


text:
Code golf a random orthogonal matrix
An orthogonal matrix is a square matrix with real entries whose columns and rows are orthogonal unit vectors (i.e., orthonormal vectors).
This means that M^T M = I, where I is the identity matrix and ^T signifies matrix transposition.
Note that this is orthogonal not "special orthogonal" so the determinant of M can be 1 or -1.
The aim of this challenge is not  machine precision so if M^T M = I to within 4 decimal places that will be fine.
The task is to write code that takes a positive integer n > 1 and outputs a random orthogonal n by n matrix.  The matrix should be randomly and uniformly chosen from all  n by n orthogonal matrices.   In this context, "uniform" is defined in terms of the Haar measure, which essentially requires that the distribution does not change if multiplied by any freely chosen orthogonal matrix.  This means the values of the matrix will be floating point values in the range -1 to 1.
The input and output can be any form you find convenient.
Please show an explicit example of your code running.
You may not use any existing library function which creates orthogonal matrices. This rule is a little subtle so I  will explain more. This rule bans the use of any existing function which takes in some (or no) input and outputs a matrix of size at least n by n which is guaranteed to be orthogonal.  As an extreme example, if you want the n by n identity matrix, you will have to create it yourself.
You can use any standard random number generator library for choosing random numbers of your choosing.
Your code should complete within at most a few seconds for n < 50.

So using built-in identity matrix is forbidden?

@JHM  You can't use it to create an n by n identity matrix at least.

What about diag? It creates an diagonal matrix which is indeed orthogonal but not always orthonormal.

This seems to be an example of "do X without Y", which - so the consensus - should be avoided.

Diagonal matrices aren't orthogonal matrices so diag should be ok.

Haskell, 169 150 148 141 132 131 bytes
import Numeric.LinearAlgebra
z=(unitary.flatten<$>).randn 1
r 1=asRow<$>z 1
r n=do;m<-r$n-1;(<>diagBlock[m,1]).haussholder 2<$>z n

Recursively extend an orthogonal matrix of size n-1 by adding 1 to lower right corner and apply a random Householder reflection. randn gives a matrix with random values from a gaussian distribution and z d gives a uniformly distributed unit vector in d dimensions.
haussholder tau v returns the matrix I - tau*v*vᵀ which isn't orthogonal when v isn't a unit vector.
Usage:
*Main> m <- r 5
*Main> disp 5 m
5x5
-0.24045  -0.17761   0.01603  -0.83299  -0.46531
-0.94274   0.12031   0.00566   0.29741  -0.09098
-0.02069   0.30417  -0.93612  -0.13759   0.10865
 0.02155  -0.83065  -0.35109   0.32365  -0.28556
-0.22919  -0.41411   0.01141  -0.30659   0.82575
*Main> (<1e-14) . maxElement . abs $ tr m <> m - ident 5
True

Making the 1×1 matrix takes too much space for my taste, a special case just for getting zero from a gaussian random variable :/ (Without it, there's a infinitesimal chance to get a zero column)

I like your spirit of making it totally correct, but i think you can drop that requirement. In my code there is also a chance that 2 rows are linearly dependent and no one cares.

@KarlNapf well, I figured out a way to lose two bytes from that part anyway, so problem partly solved :)

Ah okay, deleting my comments...

Always happy when a Haskell answer wins!

Python 2+NumPy, 163 bytes
Thanks to xnor for pointing out to use normal distributed random values instead of uniform ones.
from numpy import*
n=input()
Q=random.randn(n,n)
for i in range(n):
 for j in range(i):u=Q[:,j];Q[:,i]-=u*dot(u,Q[:,i])/dot(u,u)
Q/=(Q**2).sum(axis=0)**0.5
print Q

Uses the Gram Schmidt Orthogonalization on a matrix with gaussian random values to have all directions.
The demonstration code is followed by
print dot(Q.transpose(),Q)

n=3:
[[-0.2555327   0.89398324  0.36809917]
 [-0.55727299  0.17492767 -0.81169398]
 [ 0.79003155  0.41254608 -0.45349298]]
[[  1.00000000e+00   0.00000000e+00   0.00000000e+00]
 [  0.00000000e+00   1.00000000e+00  -5.55111512e-17]
 [  0.00000000e+00  -5.55111512e-17   1.00000000e+00]]

n=5:
[[-0.63470728  0.41984536  0.41569193  0.25708079  0.42659843]
 [-0.36418389  0.06244462 -0.82734663 -0.24066123  0.3479231 ]
 [ 0.07863783  0.7048799   0.08914089 -0.64230492 -0.27651168]
 [ 0.67691426  0.33798442 -0.05984083  0.17555011  0.62702062]
 [-0.01095148 -0.45688226  0.36217501 -0.65773717  0.47681205]]
[[  1.00000000e+00   1.73472348e-16   5.37764278e-17   4.68375339e-17
   -2.23779328e-16]
 [  1.73472348e-16   1.00000000e+00   1.38777878e-16   3.33066907e-16
   -6.38378239e-16]
 [  5.37764278e-17   1.38777878e-16   1.00000000e+00   1.38777878e-16
    1.11022302e-16]
 [  4.68375339e-17   3.33066907e-16   1.38777878e-16   1.00000000e+00
    5.55111512e-16]
 [ -2.23779328e-16  -6.38378239e-16   1.11022302e-16   5.55111512e-16
    1.00000000e+00]]

It completes within a blink for n=50 and a few seconds for n=500.

I don't think this is uniform. Your starting distribution with a cube, which has more stuff towards the diagonals. Random gaussians would work because they generate a spherically symmetric distribution.

@xnor fixed. Luckily, this costed exactly 1 byte.

@xnor Even more lucky, this saved the bytes for -0.5

Almost, you need the mean of the normal to be 0, but that's no longer than n.

APL (Dyalog Unicode), 63 61 bytes
⎕CY'dfns'
n←⊢÷.5*⍨a←+.×⍨
{{⍵,(n⊢-⊣×a)/⌽⍺,⍵}/⊂∘n¨↓NormRand⍵ ⍵}

Try it online for n=5
-1 byte thanks to @user41805 (improved train for inner dfn)
Uses the modified Gram-Schmidt process on a set of n random unit vectors --- fast.
How?
⎕CY'dfns'   ⍝ Copy the dfns namespace, which includes the NormRand dfn
n←⊢÷.5*⍨+.×⍨  ⍝ n: normalize the vector argument, from https://codegolf.stackexchange.com/a/149160/68261
{{⍵,(n⊢-⊣×+.×⍨)/⌽⍺,⍵}/⊂∘n¨↓NormRand⍵ ⍵} ⍝ Main anonymous function
                           NormRand ⍵ ⍵  ⍝ Generate an n×n array of gaussian variables
                       ⊂∘n¨↓             ⍝ Treat as an array of singular arrays of n-vectors; normalize each
 {                   }/                  ⍝ Reduce in a sneaky manner to get array of orthogonal (e_1, ... e_n)
                                         ⍝ Start with e_arr=⍬ (empty)
                                         ⍝ For each vector v_i:
                ⌽⍺,⍵                      ⍝ Start this step with e_arr←(e_{i-1}, ..., e_1, e_0, v_i)
    (         )/                          ⍝ Reduce this to repeatedly modify from the right:
     n⊢-⊣×+.×⍨                             ⍝ Normalize(v_i - proj_{e_j}(v_i))
  ⍵,                                       ⍝ Append this to e_arr

You should be able to trainify the innermost dfn like spoiler

@user41805 Nice! That saves 1 byte over my train and lets me save another since it repeats +.×⍨

Mathematica, 69 bytes, probably non-competing
#&@@QRDecomposition@Array[RandomVariate@NormalDistribution[]&,{#,#}]&

QRDecomposition returns a pair of matrices, the first of which is guaranteed to be orthogonal (and the second of which is not orthogonal, but upper triangular). One could argue that this technically obeys the letter of the restriction in the post: it doesn't output an orthogonal matrix, but a pair of matrices....
Mathematica, 63 bytes, definitely non-competing
Orthogonalize@Array[RandomVariate@NormalDistribution[]&,{#,#}]&

Orthogonalize is unambiguously forbidden by the OP. Still, Mathematica is pretty cool eh?

You may not use any existing library function which creates orthogonal **matrices**.

Uses library functions which generate orthoganal matrices.