Produce the number 2014 without any numbers in your source code

Note to challenge writers as per meta consensus: This question was well-received when it was posted, but challenges like this, asking answerers to Do X without using Y are likely to be poorly received. Try using the sandbox to get feedback on if you want to post a similar challenge.

It's 2017 2018 2019 2020 2021 already, folks, go home.

So, now that it's 2014, it's time for a code question involving the number 2014.

Your task is to make a program that prints the number 2014, without using any of the characters 0123456789 in your code, and independently of any external variables such as the date or time or a random seed.

The shortest code (counting in bytes) to do so in any language in which numbers are valid tokens wins.

• Even though numbers are ignored in brainfuck, I thought I'd post one anyway. 32 Chars: ++++++[>++++++++<-]>++.--.+.+++. – Braden Best Apr 1 '15 at 21:37
• Brainfuck isn't a valid language for this challenge. – Joe Z. Apr 1 '15 at 22:49
• I know. That's why I posted it as a comment – Braden Best Apr 1 '15 at 22:51
• I wonder if this question gets a small spike in popularity around New Year's. – Joe Z. Dec 26 '15 at 23:28
• Waiting for "Come on folks, don't you realize it's 2016?" :) – padawan Jan 4 '16 at 23:35

Hassium, 77 Bytes

Really excited about this one. It gets Math.pi and divides it by itself in variable a (1), then uses increment and basic math operators to get it to 2014.

use Math;func main(){a=Math.pi;a/=a;print(++a)print(a-a)print(a/a)print(a*a)}

Run online and see expanded here

Milky Way 1.0.0, 22 bytes

<^a:::+;:l+:>h<::++-<-

Explanation

<          <     <   # rotate the stack leftward
^                   # pop the TOS without outputting
a                  # logical not on the TOS
:::  :   ::       # duplicate the TOS
+       ++     # push the sum the top two stack elements
;             # swap the top two stack elements
>           # rotate the stack rightward
h          # push the TOS to the power of the second stack element
- -  # push the difference of the top two stack elements

The stack defaults to ["", 0].

Stack Visualization

["", 0]                # default stack

[0, ""]                # <
[0]                    # ^
[1]                    # a
[1, 1, 1, 1]           # :::
[1, 1, 2]              # +
[1, 2, 1]              # ;
[1, 2, 1, 1]           # :
[1, 2, 1, 10]          # l
[1, 2, 11]             # +
[1, 2, 11, 11]         # :
[11, 1, 2, 11]         # >
[11, 1, 2048]          # h
[1, 2048, 11]          # <
[1, 2048, 11, 11, 11]  # ::
[1, 2048, 33]          # ++
[1, 2015]              # -
[2015, 1]              # <
[2014]                 # -

By default, if nothing has been output manually, the bottom stack item is output on termination of the program.

Milky Way (current version), 8 bytes

XZ*W+U+!

Explanation

X         # push 20 to the stack
Z        # push 100 to the stack
*       # push the product of the TOS and STOS
W      # push 10 to the stack
+ +   # push the sum of the TOS and STOS
U    # push 4 to the stack
!  # output the TOS

Jolf, 3 bytes

(It's almost 2016. Language obviously postdates question.)

@ߞ
@  Get charcode of next character
ߞ charcode 2014

JavaScript, 9 bytes

btoaÛMx

This Base-64 encodes ÛMx to make 2014.

Lua, 32 bytes

print(#'XX'..#''..#'X'..#'XXXX')

This makes use of the length operator # used on string literals to get numbers, and the lengths are concatenated (with ..) to print 2014

05AB1E, 6 bytes (non-competing)

T·žvÍ«

Uses the CP-1252 encoding. Try it online!

Explanation:

T       # Push 10
·      # Multiply by 2
žv    # Push 16
Í   # Subtract 2
«  # Concatenate
# Implicit output
• +1 from me. Here a 6-byte alternative: Txs4+J (Push 10; Duplicate and double copy (10,20); swap; Add 4; Join together). – Kevin Cruijssen Sep 10 '18 at 13:31
• 5-byter 'ߞÇ. Uses default ASCII encoding (so both ߞ and Ç are 2 bytes each), because ߞ doesn't exist in 05AB1E's codepage. – Kevin Cruijssen Jan 14 '19 at 12:51

Brain-Flak, 50 bytes

((((((()()()()()){}){})){}{}()){()()({}[()])}{}())

Try it online!

Brain-flak is great for restricted source challenges because there are only 8 valid character to begin with: brackets. (e.g. []{}()<>).

This was made possible with the help of @ASCII-only's integer metagolfer, which is currently hosted online at brain-flak.github.io/integer

• Using the integer metagolfer in WheatWizard's brain-flak optimizer I found ((((((()()()()()){}){})){}{}()){()()({}[()])}{}()) which is 4 bytes shorter. – 0 ' Dec 15 '16 at 7:30
• The challenge requires languages in which 0123456789 are valid tokens. Does Brain-Flak satisfy this requirement? – Dennis Jan 7 '17 at 17:17

Brain-Flak, 46 + 3 = 49

Try it online

(([()]([(()()())]((((({}){}){}()){}){})))()())

This one uses the -A flag for +3 bytes. It pushes the ASCII values for 2014 to the stack which outputs as 2014 in ASCII mode.

• The challenge requires languages in which 0123456789 are valid tokens. Does Brain-Flak satisfy this requirement? – Dennis Jan 7 '17 at 17:17
• @Dennis yes @lt flags use decimal literals – Wheat Wizard Jan 7 '17 at 21:59

Sinclair ZX81 15 bytes 10 bytes

PRINT CODE "=";CODE ":"

As the ZX81 has a non-ASCII compatible character set, the character code for = is 20 and for : it is 14 - simples.

• You've used a 1 in your answer. – caird coinheringaahing Apr 2 '17 at 1:09
• There is no way around making a ZX81 BASIC program without using line numbers. You may take out the line number and run it in direct mode if you wish. – Shaun Bebbers Apr 2 '17 at 6:27
• This is perhaps another reason why retrocomputing @ Stack Exchange should allow one-liners and code-golf therem, but apparently this would not constitute retro computing. Or something. – Shaun Bebbers Apr 2 '17 at 6:30
• Correction on my last comment: there not therem. – Shaun Bebbers Apr 2 '17 at 7:24

Fourier, 12 bytes

Non-competing: Fourier is newer than the challenge

I know I'm two years too late, but it seemed like a fun challenge to do in Fourier.

^^ovvo^o^^^o

The command ^ increments the value of the accumulator (which starts at zero) and v decrements the value of the accumulator.

Try it online!

\\\
O))\ \
#)) o )
))u ))
))  ))
))  )u
))  ~
~~~

I like this.

J, 21 bytes

,":,.$,:~}.,:,:'golf' Try it online! 'golf' One dimensional array ,:,: Itemize twice (1x1x4 array) }. Drop first element (0x1x4) ,:~ Append to itself as distinct items (2x0x1x4)$                 Get dimensions (2 0 1 4)
,.                  Flatten items, essentially prints 2014 vertically.
(so there are no spaces)
,":                    To strings, flatten.

20 bytes

#.(#_),,~(,~,~#_),%_
#.(#_),,~(,~$,._),%_ 15 bytes do'bbbc',~":_bd 11 bytes ,":_bk,:_be ><>, 7 bytes aa+nen; Try it online! aa + n e n ; ^^ ^ ^ ^ ^ ^ Push 10 to stack twice, add top two items in stack, print top item in stack as a number, push 14 to stack, print top item in stack as a number, stop. • 6 bytes: eaa+n< – Jo King Apr 12 '18 at 0:43 JavaScript, various solutions: 131, 44, 43, 30, 28, and 16 characters (16 bytes) Original answer: JS-fuck inspired JavaScript, 131 characters: (!![]<<(!![]<<!![])<<!![]<<(!![]<<!![])<<!![]<<(!![]<<!![])<<!![]<<(!![]<<!![]))-((!![]<<!![])<<!![]<<(!![]<<!![])<<!![])-!![]-!![] Shifty truth edition: (true<<(true<<true)<<true<<(true<<true)<<true<<(true<<true)<<true<<(true<<true))-((true<<true)<<true<<(true<<true)<<true)-true-true Addenda Edit: I'm having too much fun with this... combining type coercion with hex strings, 44 characters. a=+[];(a+'xade')-(a+'x'+(+!a+!a+!a)+a+a) a=+[];(a+'xade')-(a+'x'+(++a+a+a)+--a+a) a is 0, 0xade is 2782. We need to subtract 768 to get 2014. 768 is 0x300. (a+'x'+(+!a+!a+!a)+a+a) and (a+'x'+(++a+a+a)+--a+a) are two ways of producing "0x300", so the final result is "0xade" - "0x300", which JavaScript coerces back to numbers, resulting in 2014. Here is a radix 36-based parseInt solution, 43 characters: (a=+[]);parseInt(++a+'jy',a+++a+++''+(a+a)) First, we initiate a variable a at 0 (clearly this requires non-strict mode), increment it to 1, concatenate with 'jy' - 1jy happens to be 2014 in radix 36. The quickest way call parseInt at this radix is to generate the string "36" and abuse type coercion again: a++ + a++ results in 3, with a set to 3 as well, which means (a+a) is 6, so a+++a+++''+(a+a) results in "36", resulting in 2014. After coming up with these two solutions I started looking at other JavaScript answers (thanks for the tip, Scrooble!), to see if combining ideas from other people gives interesting results. Zaq's approach can be shortened with the hex string trick to 28 characters: -~[]+!![]+[+[]]+ +(+[]+'xe') How it works: -~[]+!![]+[+[]] results in "20", +[]+'xe' results in "0xe". +"0xe" is 14, so "20" + +"0xe" becomes "20" + 14, which becomes "2014". Now here's a fun fact: 20 in hexadecimal is 0x14! Oh, and 14 is 0xe. So +('0x' + 0xe) produces 20. Combining this with the above results in a 30 character solution: _=+[]+'x';+(_+ +(_+='e'))+[+_]" Finally, initially inspired by Dan Prince's answer I came up with what might be the shortest possible JavaScript solution abusing hex-strings, at 16 characters: +[]+'xfbc'>>!![] 0xfbc is 4028. Shift right by one, and we have 2014. If anyone knows of a shorter way to generate 0 or 1, let me know. Edit2: having exhausted the hexadecimals, we should of course also look at binary and octal notation! // +'0b11111011110' +(a=+[],a+++'b'+(a+(((a+=[a]+a+a+(+[])))+a))) // +'0o3736' +(a=-~[],a=a+++a+++''+(a+a),+[]+'o'+((+a+1)+a)) • Welcome to the site, and nice first post! – Khuldraeseth na'Barya Mar 8 '18 at 20:55 • Thanks. Do you know of any ways to show all answers on one page so I can quickly check for duplicates next time? ;) – Job Mar 8 '18 at 20:57 • @Job the stack snippet in the question body lists by shortest solutions and the shortest solutions by language. I've never been able to see them on mobile/in the app, though, so your mileage may vary. – Giuseppe Mar 8 '18 at 21:11 • @Job You can do a search with inquestion. For just about all questions, there'll be just one page of results. The 17005 is this question's ID, found in the URL. – Khuldraeseth na'Barya Mar 8 '18 at 21:23 • Thanks for the tips! Added some more solutions :) – Job Mar 9 '18 at 0:28 Pyt, 27 bytes ɳąḞḞ⬠⬠⬠π⎶⁻⦋ĐąžΠ²+ĐŚřƩ½*-⁻⁻Ɩ Try it online! Not exactly a serious contender, just had some fun. ɳ push '0123456789' as string ą convert to array of digits [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ḞḞ for each item in array, replace with xth fibonacci # (2x) [1, 1, 2, 3, 8, 34, 377, 17711, 9227465, 225851433717] ⬠⬠⬠ for each item in array, replace with xth pentagonal # (3x) [1, 1, 1820, 66045, 240027425, 29321506727800, 6947548864499411875070L, 165405818231059923692911546880492501L, 898044801648686628863443901192030771814779461710865094720L, 115670237695821250427139838385782853032222541808893547195455834936957002151009052998969975100L] π⎶⁻ push pi, round, and decrement (2) ⦋ get the 2th element of that list (1820) Đ Duplicate 1820 ąž make an array of digits and remove zeroes [1, 8, 2] Π multiply together (16) ²+ square and add (2076) ĐŚ Duplicate and sum digits (15) řƩ make a range from 1 to 15 and sum all (120) ½* multiply by 1/2 (60) - subtract (2016.0) ⁻⁻ decrement (2x) (2014.0) Ɩ cast to integer (2014) implicit output Julia 0.6, 9 bytes Int('ߞ') Try it online! Just for completeness' sake. Here's 2018 (same trick, different character): Int('ߢ') Try it online! And just for fun, here's a function using bit shifting and arithmetic instead of using character codepoints (depends on this being Julia version 0.6, which seems an appropriately golf-y hack): Julia 0.6, 47 bytes (l=VERSION.minor,o=true)->o<<(l+l-o)-o<<~-l-o-o Try it online! Here, o=true evaluates as 1 during arithmetic. VERSION is an inbuilt constant containing the current Julia version, and VERSION.minor is 6 in this case. We left shift 1 by 6+6-1=11, giving 2048, then subtract 1<<(6-1)=32 and 1 and 1 from it, to give 2014. 2018 version would be: (l=VERSION.minor,o=true)->o<<(l+l-o)-o<<~-l+o+o JavaScript (ES6), 52 46 bytes t=-~'';console.log(${++t}${t-t}${t/t}${t*t}) Try it online! Will log through console.log the number 2014 as a string. Thanks to Jacob for multiple optimizations saving 6 bytes Explanation t=-~''; In JavaScript, ~~ will convert the proceeding value to a number, in this case, true equates to 1. Set the value of t to 1 by using ~ on an empty string, which would equate to -1, then take the opposite of that number, 1. For more info about tilde in JavaScript, see this article. console.log( ... ) Logs the template string ... with${} expressions available, where ... includes:

${++t} Sets w to t+t, which would be 2, which would return the number 2. Added to string. Set t to itself + 1, and display the final result, 2${t-t}

Displays t-t, which would be 0, which would return the number 0.

${t/t} Takes the value of t and divides by itself, returning 1.${t*t}

Takes the value of w*w*w*w-w (or w ^ 4 - 1), where w (as previously set) is 2, and subtracts w from it, and returns the result. Added to string.

Takes the value of t*t (or t ^ 2), where t (as previously set) is 2.

The added expressions equate to 2014, which ... is in the log.

• Technically you don't need the ~~ before the true – Jo King Jun 19 '18 at 0:46
• t=-~'';console.log(${++t}${t-t}${t/t}${t*t}) – Jakob Jun 19 '18 at 1:45

Lost, 5723 22 bytes

<^/*(
)/@+
">>v
^?%<<

Byte-count more than halved (-35 bytes) thanks to @JoKing.

Let me start with an explanation of Lost itself. 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, down, left, or right.

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

Program explanation:

The 22-bytes program is similar as the previous 23-bytes program below, but with a smarter path to save that byte:

v<<<<<>>>>>
>%?"^ <"*+@

The "^ <" will push the character-codepoints for the three characters in the string, being 94 32 60 respectively. The * multiplies the top two, and + adds the top two of the stack, so it becomes 94+(32*60), which results in 2014.

The @ will terminate the program, but only if the safety is 'off'. When the program starts the safety is always 'on', otherwise the program starting at the exit character immediately terminates without doing anything.
The % will turn the safety 'off'. So as soon as the % is encountered and the safety is 'off', the program can be terminated with an @.

The ? is to clean up the stack if it started somewhere in the middle.

And finally the v<<<<<>>>>>, > and use of ^ < in the string are to lead the program path towards the correct starting position for it to correctly print 2014. 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.

Now for the 22-bytes solution, and how it actually is the same as the 23-bytes solution, but with a different path.

The arrows are still used to lead the path into the given direction. The / are used as a mirror. So if we go from right to left and encounter the /, it will continue downwards; if we go from the top to the bottom and encounter the /, it will continue towards the left; etc.

The ( will pop the top value on the stack and push to to the scope, and the ) will do the reversed: it pops from the scope, and pushes it back to the stack.

So regardless of where we start and in which direction we travel, the path leads towards the first < of the bottom row. From there, the program flow travels in this order:

%?^        Direction changed upwards
" <^" <    Direction changed towards the left
(*/        Direction changed downwards
/          Direction changed towards the left
) +@

So it will:

• Turn the safety 'off' with %;
• Clean the stack with ?;
• Push the character-codepoints for " <^", which are 32 60 94 respectively;
• Pop the 94 and store it in the scope with (;
• Multiply the 32 60 with *, resulting in 1920;
• Push the 94 from the scope back onto the stack with );
• Add the 1920 94 together with +, resulting in 2014;
• And then terminates the program with @, implicitly outputting the top of the stack.
• Why not calculate the 2014 code point and skip the -A flag? 23 bytes – Jo King Nov 1 '18 at 9:46
• @JoKing Ah, didn't thought about that.. Thanks a lot for halving the byte-count! :) – Kevin Cruijssen Nov 1 '18 at 10:18
• 22 bytes. How it actually works is a bit weird... – Jo King Nov 1 '18 at 10:26
• @JoKing Oh, smart! That 23-byter was pretty obvious and I can't believe I missed it now. But that 22-byter is very smart and not something I would have thought of myself. Well done! It's only my first Lost answer, so hopefully I will get better at it. Btw, out of curiosity, is there a reason the language is lacking a divide and modulo operator? – Kevin Cruijssen Nov 1 '18 at 10:43
• shrugs Minimalism? – Jo King Nov 1 '18 at 12:53

><>, 7 4 bytes

"nߞ

Try it online!

Explanation

"nߞ      : Put the string nߞ onto the stack.            Stack: [110, 2014]
n       : Print the top item of the stack as a number. Stack: [110]
ߞ      : Error out.

Flobnar, 17 14 bytes

<+\@:!
+<>.!..

Try it online!

Explanation:

@       Start, going left

\        Push to the stack the value from the bottom row
>

.!..   Several print statements we will get back to
<   :!    Add the not of the top of the stack to itself
+         This is !0+!0 = 2

.   Print the 2

.    Print the result of the print (0)

.!     Print the result of the not of the print (1)
\       Continue forward after pushing the zero to the stack

<+   :!   Add the same 2 from the beginning to itself
+<        (!0 + !0)+(!0 + !0) = 4
And print implicitly as the last value

05AB1E, 221087 6 bytes

T·žvÍJ

Try it online!

How it works:

• T pushes 10, · doubles it, we get 20.
• žv pushes 16, Í subtracts 2, we get 14.

Lastly, we concatenate them using J!

• Hi, welcome to PPCG! See here for an existing 6- and 5-byte 05AB1E answer. But to golf your approach a bit more: 1. you can remove all « and only have a single J (join) at the end. 2. You could save values in between with © and use it later on with ® (i.e. žh¦¦©нžhнžh¦н®¦¦нJ). 3. There are builtins for the numbers 0, 1, and 2 if you don't change them later on, which are ¾, X, and Y respectively, so an alternative 6-byter could be Y¾XY·J (push 2; push 0; push 1; push 2 and double it; join all values on the stack together). – Kevin Cruijssen Sep 2 '19 at 8:12
• (this last one doesn't really look like your initial approach anymore, but just stating it as example). And if you haven't seen it yet, tips for golfing in 05AB1E might be interesting to read through. :) – Kevin Cruijssen Sep 2 '19 at 8:13
• Digits aren't allowed though. Otherwise just Ž7æ (compressed 2014) or 2014 itself would be enough. :) – Kevin Cruijssen Sep 4 '19 at 10:42
• @KevinCruijssen Oh, how silly. I forgot. – mekb Sep 4 '19 at 10:43
• I've found a 10 byte solution now. I don't think there might be any room for improvement. – mekb Sep 4 '19 at 11:08

C#, 25 bytes (24 characters)

Console.Write((int)'ߞ');

Try it online!

Explanation

The decimal Unicode of ߞ is 2014, so you can just cast it to an int and 2014 is printed.

• Welcome! Though admittedly, the answer is simple, in general it is best to add an explanation or link to an online interpreter. Code-only answers are usually automatically flagged as low-quality, meaning that those answers have to be reviewed by someone. – mbomb007 Aug 30 '19 at 21:19
• @mbomb007 yeah i was thinking about adding a link to tio.run, i'll do that – Sagittarius Aug 31 '19 at 9:09

Python 3, 16 bytes (15 characters)

print(ord('ߞ'))

Try it online!

Explanation

ord returns the decimal Unicode of a character, and the decimal Unicode of ߞ happens to be 2014.

Python 2?

I tried doing the same thing in Python 2 (print ord('ߞ')), which would be 1 byte less, but this doesn't work. Why? Well, in Python 3, len('ߞ') returns 1. However, in Python 2, len('ߞ') returns 2. And since ord only takes a string of length 1 (or a char, but Python doesn't have chars), Python 2 doesn't really like that: TypeError: ord() expected a character, but string of length 2 found

Python, 52 49 chars

from math import*
print(int((e*pi+e)**pi+e/e+e))

Works in Python 2 and Python 3.

Labyrinth, 12 bytes

))!!)!))))!@

Try it online!

))))_#!!#!!@

Try it online!

))_#"
) !!@

Try it online!

))!"
)
)#!!@

Try it online!

I tried both linear and complex layouts, but I can't figure out how to remove a single byte from any of these programs.

Straw, 13 bytes

(…………………σ)«$> « sum the codepoint of all characters in a string,$ convert from unary to decimal and > is the print operator.

Try it online

Hexagony, 18 bytes

g{A*'-"'-'"Av<@!}/
g { A
* ' - "
' - ' " A
v < @ !
} / .

I had trouble getting it to fit in 19 bytes (side length 3) because I was always 1 short, then I rearranged my memory accessing to be 1 shorter, which also allowed me to use a very efficient layout. Then I was able to shift a no-op somewhere in the code to the very end saving a byte.

Try it online!

c'ߞ

Try it online!

MAWP, 16 bytes

!!M:!!A:!:!!M!M:
chr:pos:stack
! : 1 : [1,1]
! : 2 : [1,1,1]
M : 3 : [1,2]
: : 4 : [1]
! : 5 : [1,1]
! : 6 : [1,1,1]
A : 7 : [1,0]
: : 8 : [1]
! : 9 : [1,1]
: : 10 : [1]
! : 11 : [1,1]
! : 12 : [1,1,1]
M : 13 : [1,2]
! : 14 : [1,2,2]
M : 15 : [1,4]
: : 16 : [1]

Try it!

• Ayy, somebody actually uses my language :D – Dion Aug 6 '20 at 5:22
• I tried using _ in the online interpreter, but for some reason it didn't work. I made a Gtihub issue on it. I'd like to solve some more puzzles, but that operator is causing a bit of a problem. – Razetime Aug 6 '20 at 5:24
• Ok, will check and fix. Thanks for notifying me! – Dion Aug 6 '20 at 5:25

Python 3, 49 bytes

for i in['..','','.','....']:print(len(i),end='')

Python 3, 15 bytes

print(ord('ߞ'))
• Welcome to the site, and creative first answer! You can improve your score by remove the spaces before the [, before the print and before the end: Try it online! – caird coinheringaahing Nov 17 '20 at 21:54
• @cairdcoinheringaahing thanks for notice me! – Amir reza Riahi Nov 17 '20 at 21:57