g | x | w | all
Bytes Lang Time Link
000CASIO BASIC CASIO fx9750GIII250507T215107Zmadeforl
007Python 2200410T102701ZCommand
038Pascal240404T000035ZKai Burg
008CellTail221005T190157Zmousetai
001Noxan220304T124625ZNoxan Bo
003><>220127T162829ZFmbalbue
002Gol><>220127T162806ZFmbalbue
004Uselesslang211225T154243ZFmbalbue
001J200411T133029ZPkmnQ
004naz200411T045240Zsporebal
008Malbolge200410T185858Zdingledo
003TrumpScript200410T152303ZElPedro
000Visual Basic .NET VBC200410T155906Zthe defa
001Enlist200410T154618ZElPedro
011Lost200410T124443ZKevin Cr
772Lenguage200410T122514ZKevin Cr
012Nandy200410T103855Zuser9206
015Python 3 without literals200410T120053ZPkmnQ
012C gcc200410T110659ZNoodle9
012AWK200410T112452ZNoodle9
003+=200410T112301Zuser9206
004JavaScript Node.js200410T112039ZCommand
006Bash200410T111456ZNoodle9
007Python 3200410T110431ZNoodle9
010Whitespace200410T103859ZKevin Cr
004Java 8200410T103606ZKevin Cr
003Width200410T103102Zuser9206
014brainfuck200410T102533ZCommand
00105AB1E200410T101749ZCommand

CASIO BASIC (CASIO fx-9750GIII), 0 bytes (?!?!?!)

2

Yes. That is 0 bytes.

I have no clue how this works.

Python 2, 7 bytes

print 2

Explanation

prints 2

Try it online!

Pascal, 38 characters

Are there any restrictions on the utilized number system? 🤔 In Pascal, string literals cannot contain arbitrary data. For the following program to work, the character 𒐖 must be a permissible value of the implementation‑defined set of char values.

program p(output);begin write('𒐖')end.

The whole deal using Standard Pascal (ISO standard 7185, level 0 sufficient) could look like this:

{ This program depends on `output`.
  I. e. `./a.out >&-` (shell syntax closing output) should/could fail. }
program evenPrimeNumbers(output);
    { Pascal is a strongly typed and awesome programming language. }
    type
        { A variable of type `natural` can only assume
          integral values in the range `1` through `maxInt` inclusive. }
        natural           = 1‥maxInt;
        naturals          = set of natural;
        { In Standard Pascal as defined by ISO standard 7185
          functions cannot return structured value types.
          Therefore `divisors` returns a pointer data type. }
        naturalsReference = ↑naturals;
    
    { In Standard Pascal as defined by ISO standard 7185 there is a strict
      order `label` → `const` → `type` → `var` → routines → `begin … end`. }
    var
        primeNumberCandidate: natural;
    
    { Returns divisor ∣ dividend. }
    function divides(divisor, dividend: integer): Boolean;
        begin
            { Division by zero is undefined so do not attempt it. }
            if divisor = 0 then
            begin
                { In Pascal the result of a function is defined by
                  assigning a value to the implicitly defined (semi‑)variable
                  bearing the function’s name. }
                divides ≔ false
            end
            else
            begin
                { Modulo divisor must be positive. }
                divides ≔ dividend mod abs(divisor) = 0
            end
        end;
    
    { Returns the set of all divisors of n. }
    function divisors(n: natural): naturalsReference;
        var
            divisorCandidate: natural;
            factors: naturalsReference;
        begin
            { Allocate memory for factors and assign address to `factors`. }
            new(factors);
            { Trivial divisors. }
            factors↑ ≔ [1, n];
            
            for divisorCandidate ≔ 2 to round(sqrt(n)) do
            begin
                if divides(divisorCandidate, n) then
                begin
                    { The plus sign (also) identifies the union of two sets. }
                    factors↑ ≔ factors↑ + [divisorCandidate]
                end
            end;
            
            divisors ≔ factors
        end;
    
    { Returns primality of n. }
    function primality(n: natural): Boolean;
        begin
            { Note the distinction between `≔` (becomes) and `=` (equals). }
            primality ≔ divisors(n)↑ = [1, n]
        end;
    
    { ─── MAIN ─── }
    begin
        for primeNumberCandidate ≔ 1 to maxInt do
        begin
            { Skip primality test if it is not an even number. }
            if not odd(primeNumberCandidate) then
            begin
                if primality(primeNumberCandidate) then
                begin
                    writeLn(output, primeNumberCandidate)
                end
            end
        end
    end.

See also trial division algorithm on RosettaCode.

CellTail, 8 bytes

I=2;O=N;

Try it

Explanation:

I should really get around to setting up these things as flags.

Noxan, 1 byte

2

Implicitly prints out 2.

><>, 3 bytes

2n;

Try it online!

Gol><>, 2 bytes

2h

Try it online!

Uselesslang, 4 bytes

>>. 

(There is trailing space)

J, 1 byte

2

Explanation

2 NB. 2

naz, 4 bytes

2a1o

Simply adds 2 to the register and outputs.

Malbolge, 8 bytes

D'<;:^"J

Try it online!

TrumpScript, 3 bytes

a
b

Try it online!

The error message in the output contains all even prime numbers and no other numbers. Well no-one said the output couldn't include other non-numeric text.

The exception message is a bit special:

Exception: Trump will ensure that 'America is great'

As a (not very much) more serious effort (without errors):

TrumpScript, 36 bytes

say 1000002-1000000
America is great

Try it online!

Visual Basic .NET (VBC), 0 bytes

They added this neat function that an empty program outputs a list of the even primes via the exit code.

Try it online!

Enlist, 1 byte

2

Try it online!

Just picked a random language on TIO and it worked. Oh well, it's another language to add to the list.

Lost, 11 bytes

v<<>>
>(%2@

Try it online or verify that it's deterministic.

Explanation:

Explanation of the language in general:

Lost is a 2D path-walking language. Most 2D path-walking languages start at the top-left position and travel towards the right by default. Lost is unique however, in that both the start position AND starting direction it travels in is completely random. So making the program deterministic, meaning it will have the same output regardless of where it starts or travels, can be quite tricky.

A Lost program of 2 rows and 5 characters per row can have 40 possible program flows. It can start on any one of the 10 characters in the program, and it can start traveling up/north, down/south, left/west, or right/east.

In Lost you therefore want to lead everything to a starting position, so it'll follow the designed path you want it to. In addition, you'll usually have to clean the stack when it starts somewhere in the middle.

Explanation of the program:

All arrows will lead the path towards the > on the second line. From there, the program flow is as follows:

Note that the top line could have been v<<<<, but that the reversed part >> will wrap-around to the other side, making the path shorter and therefore the performance slightly better. The byte-count remains the same anyway, so why not.

Lenguage, 979,674,373,772 bytes

Unary, 2,063,923,527,196 bytes

Programs consists of 2063923527196 and 979674373772 amount of characters of your own choosing.

Port of CommandMaster's brainfuck answer.

Try it online in brainfuck.

Byte-counts generated by this program I wrote in 05AB1E.

Nandy, 12 bytes

-2 Thanks to Kevin Cruijssen.

::#oo>oo>o>o

Try it online!

Explanation

::#          Generate a 1 bit
   oo        Output 1 twice
     >       Roll the stack
      oo     Output 0 twice
        >o>o Output 1 and 0

This makes the binary codepoint of ASCII 2. 110010

Python 3 without literals, 15 bytes

exit(-~-~int())

Try it online!

C (gcc), 15 14 12 bytes

Saved a byte thanks to petStorm!!!
Saved 2 bytes thanks to Arnauld!!!

a;f(){a|=2;}

Try it online!

AWK, 12 bytes

END{print 2}

Try it online!

+-=, 3 bytes

++=

Add the accumulator by 3, then output the number.

JavaScript (Node.js), 4 bytes

v=>2

Try it online!

Bash, 6 bytes

echo 2

Try it online!

Python 3, 7 bytes

exit(2)

Try it online!

Whitespace, 10 bytes

[S S S T    S N
_Push_2][T  N
S T _Print_as_integer]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Try it online (with raw spaces, tabs and new-lines only).

Explanation in pseudo-code:

Integer n = 2
Print n as integer to STDOUT

Java 8, 4 bytes

v->2

Try it online.

Explanation:

v->  // Method with empty unused parameter and integer return-type
  2  //  Return 2

Width, 3 bytes

Curious and hoping to try it. Not short at all, since it's designed for .

Unfortunately in Width, numbers don't have the privilege of being implicitly printed. :(

Gfm

Try it online!

Explanation

G     Start a string
 fm   Codepoint 18 in the custom code page ('2')
      Implicit end quote
      Implicit print

brainfuck, 14 bytes

-[>+<-----]>-.

-[>+<-----]> is a script to generate 50 (which is the ascii code of 2) from https://esolangs.org/wiki/Brainfuck_constants#50, and then . outputs it

Try it online!

05AB1E, 1 byte

2

it pushes 2 into the stack and then implicitly outputs it, pretty boring

Try it online!