# 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 2022 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: ++++++[>++++++++<-]>++.--.+.+++. Apr 1, 2015 at 21:37
• Brainfuck isn't a valid language for this challenge. Apr 1, 2015 at 22:49
• I know. That's why I posted it as a comment Apr 1, 2015 at 22:51
• I wonder if this question gets a small spike in popularity around New Year's. Dec 26, 2015 at 23:28
• Waiting for "Come on folks, don't you realize it's 2016?" :) Jan 4, 2016 at 23:35

# PHP, 27 bytes

not in any way competitive to xfix´s solution, but here are a few versions with 27 bytes each:

<?=hexdec($c=hexdec(e)),$c;   # e->14->20, e->14
<?=ord(U)-ord(A),hexdec(e);   # 85-65,14
<?=($c=ord(","))*$c+ord(N);   # 44*44+78
<?=($c=ord("."))*$c-ord(f);   # 46*46-102

The first one already has been posted by brother Filip; but the others have not.

This one has 37 bytes, but I like it (inspired by the Calculator solution)

<?=dechex(hexdec(dfeb)^hexdec(ffff));

or 13 bytes with

<?=sqpu^AAAA;

But that idea has already been used by primo

## EXCEL: 148 bytes

=POWER(ROW()+ROW(),(ROW()+ROW()+ROW())*(ROW()+ROW()+ROW())+ROW()+ROW())-(POWER(ROW()+ROW(),ROW()+ROW()+ROW())*(ROW()+ROW()+ROW()+ROW())+ROW())-ROW()

only works in A1.

• 1. It works anywhere in row 1. 2. Use the ^ operator instead. 3. You can also save a few using row 2 instead and a little algebra: =ROW()^((ROW()+ROW()/ROW())^ROW()+ROW())-ROW()-ROW()^(ROW()+ROW()+ROW()/ROW(. But then again, you can also save some by going all the way to Row 2014 too. Jul 10, 2020 at 12:23
• Of course, concatenation is also an option. Jul 10, 2020 at 12:28

# C, 33 30 bytes

Numerical Solution 1

f(){printf("%d",'<'*'#'-'V');}

// 2014 = 60 * 35 - 86

# C, 86 83 bytes

Numerical Solution 2

#define A ((int)'}')
#define B (((int)'r')-((int)'d'))
f(){printf("%d",A*B+A+A+B);}

// A = 125
// B = 14
// 2014 = 125*14 + 125 + 125 + 14

# C, 53 50 bytes

ASCII Art 1

f(){printf("┌┐ ┌┐ ┐ ┐┌\n┌┘ ││ │ └┤\n└┘ └┘ ┴  ┴");}

Result

┌┐ ┌┐ ┐ ┐┌
┌┘ ││ │ └┤
└┘ └┘ ┴  ┴

# C, 94 91 bytes

ASCII Art 2

f(){printf("╔═╗ ╔═╗ ╗ ╦ ╦\n  ║ ║ ║ ║ ║ ║\n╔═╝ ║ ║ ║ ╚═╣\n║   ║ ║ ║   ║\n╚═╝ ╚═╝ ╩   ╩\n");}

Result

╔═╗ ╔═╗ ╗ ╦ ╦
║ ║ ║ ║ ║ ║
╔═╝ ║ ║ ║ ╚═╣
║   ║ ║ ║   ║
╚═╝ ╚═╝ ╩   ╩
• You could shorten all your mains to f, saving 3 bytes each, and your submission will still be valid. May 12, 2017 at 19:53

# Racket, 18 bytes

(~a(+ #xa #xa)#xe)

# Clojure, 9 bytes

Inspired by the Matlab answer, converts char \u075e to an int:

(int \ߞ)

## LiveScript, 18 bytes

The temporary solution

new Date!.getYear!

Unicode

\ߞ .charCodeAt!

Over Excitement

x=!Happy
Happy = -> console.log it
New = -> +it
Year = ->++x and Year
Year.valueOf = -> x

Happy New Year!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
• I initially assumed that you mean LiveScript, as in, JavaScript in first Netscape 2 beta. Jan 2, 2014 at 13:51
• @GlitchMr, that's where the name came from :-) Jan 2, 2014 at 20:06
• Only the "Unicode" solution is valid. The "temporary" solution violates the rule "... independently of any external variables such as the date or time" Sep 6, 2019 at 2:25
• ... and the "Over Excitement" solution is not a serious contender, Sep 6, 2019 at 2:35

# JSFuck, 1267 bytes

In Javascript, here is the alert(2014) ! (Try in browser Console).

[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+[!+[]+!+[]]+[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]])()

This sample uses only six different characters to write and execute code. This was generated by https://github.com/aemkei/jsfuck.

• Even though it's the longest answer rather than the shortest, +1 for JSFuck. Jan 1, 2014 at 21:04

How do you get a number without using any digits in the source? Lots of people had already done it with characters or strings, so I decided to use pi, predefined in most languages. From pi, you can get the numbers 3 and 4 easily using the ceiling and floor functions. Then you can use some combination of addition, subtraction, multiplication, and maybe division to get 2014. Just by experimenting around, it would be easy to figure out a function that takes in 3 and 4 and returns 2014 (such as 4^4 * 4 + 3^3*3^3 + 4*(3^4) - 4*4*4 + 4 - 3 = 2014). This one's 70 characters:

main=print$(\x y->y^y*y+x^x*x^x+y*x^y-y*y*y+y-x)(floor pi)$ceiling pi

Now, that's fine, but writing a function like that isn't much different than just repeatedly writing floor(pi) and ceiling(pi). Is it doable with only one pi? Well, in Haskell, functions can be treated as Monads with an instance defined in Control.Monad.Instances:

return = const
f >>= k = \ r -> k (f r) r

So you can use the bind function to pass one value into two different functions: g (f x) (h x) can be rewritten f >>= flip (g.h). id >>= f can be used to pass the one value twice into the same function: id >>= (^) for example is a function that returns x to the x power. The resulting program at 207 characters is more obfuscated than golfed, but it was fun to write:

main=print.((id>>=(^)>>=flip((+).(id>>=(+)>>=flip((+).(id>>=(-)>>=flip((+).(id>>=div))))))).floor>>=flip((-).(id>>=(^)>>=flip((*).(round.sqrt.fromInteger>>=(*)))).ceiling))$pi # VB.NET, 59 bytes MsgBox(((Asc(vbTab) + Asc(vbTab)) & Asc("~")) / Asc(vbTab)) takes the ascii values of a Tab twice (18) concats the ascii value of "~" (126), giving "18126" and then divides the lot by ascii of a Tab (9) = 2014 Alternatively, you can do MsgBox Asc("j") * vbKeyPause i.e. ascii of "j" (106) * value of the constant vbKeyPause (19), for a total of 28 characters (less than half the original). • The exact same code works for VB6 too. – Rob Jan 4, 2014 at 0:06 • user14566 suggested this edit: 27 bytes: MsgBox(Asc("") & Asc("")) =20 =14 Jan 13, 2014 at 7:05 • You can run this in the immediate window of VBA as ?Asc("j")*vbKeyPause, which shortens it up a bit. Mar 5, 2014 at 16:46 ## R, 39 31 bytes: x=T+T;x^(x*x*x+x)*x-x^(x*x)*x-x ### R, also 39 31 bytes: x=T+T;z=x*x;x^(z*x+x)*x-x^z*x-x Thanks Scrooble! ### More entertaining version: 46 bytes z=pi;x=z*z;y=exp;j=z/y(z);floor(y(x)/(x-j-j)) Not especially efficient, but I had a lot of fun messing around with this. I'm sure there's a shorter way using just those two numbers Long-form, subbing in the variables: floor(exp(pi*pi)/((pi*pi) - pi/exp(pi) - pi/exp(pi)) In real-person numbers: floor(19333.69 / (9.869604 - 0.1357605 - 0.1357605)) = floor(2014.328) • Save 8 bytes by getting 2 a shorter way. Mar 15, 2018 at 21:58 • Save a few in the entertaining one by eliminating some assignment. Mar 19, 2018 at 18:52 • And some more Mar 19, 2018 at 18:59 # 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 • -1 byte : '߾'-' ' Feb 23, 2021 at 13:06 # MathGolf, 2 bytes ID Try it online! ## Explanation I Pushes 20 D Pushes 14 The stack is printed in full on termination. # ><>, 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. • Huh, this worked really well in Runic too. One byte shorter than the solution I came up with a couple weeks ago. Not sure why I didn't try that before. Feb 6, 2019 at 2:30 # Keg, 2 bytes ߞ Keg auto pushes any characters that aren't instructions to the stack, and ߞ has a unicode value of 2014, which then gets printed. Try it Online! # Raku (previously Perl6) Raku interpret Unicode numbers as usual numbers, so: ## In REPL – 7 bytes (3 chars): ⑳~⑭ ## Without REPL – 11 bytes (7 chars): say ⑳~⑭ you can run it as rakudo -e "say ⑳~⑭" # Hexagony, 3 bytes ߞ! Try it online! Or if you prefer code that terminates, here's 4 bytes: ߞ!@ # PHP (21 chars) <?=ord('').ord(''); //These are not empty strings ;) If you don't believe it, see the proof. • That looks like 19 characters to me. Jan 2, 2014 at 15:06 • (Oh wait, nonprintables.) Jan 2, 2014 at 15:07 • If it contains non-printables, you should provide a hex dump or list them. Mar 4, 2016 at 20:06 # Clojure (177 characters) In the true Lisp-ish spirit that "too many parentheses are never enough" I present: (Integer. (clojure.string/join [(+ (second (range)) (second (range))) (first (range)) (second (range)) (+ (second (range)) (second (range)) (second (range)) (second (range)))])) How it works: The function range produces a lazy sequence of numbers. If no starting point and ending point are specified the range starts at zero and extends infinitely in the positive direction; however, because it's a lazy sequence the numbers are not produced until needed. Thus, applying the first function to the result of the range function without arguments produces the value 0, which is the first element in the sequence 0 to positive infinity. Applying the function second to such a range produces the value 1. From there it's a simple matter of producing enough 1's and summing them up to get 2 and 4, then converting them (implicitly) into strings to join then together, then converting the resulting string back to an integer. (I find it amusing that this is actually longer than some of the Brainf*ck answers - and to add to the horror, it's also legible :-). Share and enjoy. :-) • I suppose that you don't need to convert back to integer, instead add an output function. Jan 5, 2014 at 18:15 • Do you need all that whitespace? – cat Apr 18, 2016 at 2:38 # Python 51 Using true = 1 and false = 0 t=True print str(t+t)+str(t-t)+str(+t)+str(t+t+t+t) • clever. 40 chars in PHP:$t=true;echo $t+$t.$t-$t.$t.$t+$t+$t+$t; Jan 5, 2014 at 10:08 • Damn just wrote that while reading the answers well done, Jan 5, 2014 at 10:37 ## C, 31 bytes -- without a multi-character literal main(){printf("%o",'\xe'*'J');} • Save 3 bytes by shortening main to f, since we don't require main to be used. May 12, 2017 at 19:52 # Python, 30 chars s=int('RZ',ord('$'));print s+s

2014 => 2 * 1007 => RZ in base 36 => ascii code for $character In interpreted mode, without the print statement it is 24 chars: s=int('RZ',ord('$'));s+s

## Fortran: (43 27)

print*,z'FBC'/len('hi');end

Thanks to Hristo Iliev, the above is about 40% smaller! z'FBC' returns the decimal form of that hex value (which is 4028), len returns the length of hi (i.e.,2).

print*,ichar(',')*ichar(',')+ichar('N');end

Converts the string , and N to ASCII values: 44 & 78 respectively: 44**2 + 78 = 1936 + 78 = 2014.

• Shorter version using hexadecimal literals: print*,z'FBC'/len('hi');end. Jan 8, 2014 at 12:31
• @HristoIliev: Totally forgot about printing hex via z! Thanks a bunch! Jan 8, 2014 at 14:51

# Bash, 29 bytes

Bash without using external programs:

echo $((x=++y+y))$?$y$((x+x))
• Reduce to 25 bytes by using: echo $[y=++x+x]$?$x$[y+y].
– user92894
Aug 30, 2019 at 14:50

# ~-~! (No Comment), 41

Pretty basic solution.

'=~~~~~:''=~~,','@'':@''-~~:@''-~:@''+~~:

Pretty good for just 8 unique characters, eh? xD So this could theoretically be stored in 123 bits, or ~15.4 bytes.

# k [16 chars]

(*/"i"$".,")-@"" 2014 ### Explanation Get the ASCII value of ",.". "i"$".,"
46 44

Find the product

*/"i"$".," 2024 Get the data type of char. @"" 10h On running the complete code (2024-10) (*/"i"$".,")-@""
2014
• 12 chars: +/&" ~~~~h'"; 6 chars, 7 bytes, unicodey: `i\$"ߞ" Apr 13, 2017 at 13:00

## ><> (9 bytes ASCII)

In pure ASCII,

'd!:'*+n;

This pushes d, !, and : to the stack, then multiplies the numerical values of top two entries, and adds the value of the last entry before outputting the value on top of the stack as a number and ending.

Using Unicode this can be reduced to 6 bytes:

'ߞ'n;

Simply outputs the numerical value of and ends.

• You could shorten 'ߞ'n; to 'n;ߞ, I believe. Nov 1, 2015 at 12:03

### Julia, 13 characters

('x'-'e')*'j'

In Julia, most arithmetic operations, when applied to a single character, convert this character to its ASCII integer value. x, e and j are respectively 120, 101 and 106, therefore (120-101)*106 is 19*106=2014.

julia> ('x'-'e')*'j'
2014

Edit: 11 characters, thanks to Glen O

A different choice of characters allows us to skip parentheses:

'.'*'.'-'f'
• Just thought I'd point out that a different sequence can save you a few characters. For instance, '.'*'.'-'f' is only 11 characters. Jun 6, 2014 at 3:36
• @GlenO thanks! I added it as an edit. Jun 6, 2014 at 7:15

# J (13)

#.a.i.'_!!! '

Interprets the ASCII value of _!!! (95 33 33 33 32) as a binary number (it's weird that this is possible, I agree). This produces 2014.

# J (15)

This one doesn't use any character strings. It's based on the weird coincidence that the sum of the first 46 primes is 4028: double 2014.

-:+/p:i.<:+:_bn

If anyone knows of a shorter way than <:+:_bn to represent 45 (preferably without strings), please let me know.

# C#, 4 characters, 5 bytes

+'ߞ'

Note: you need LINQPad to run it, not Visual Studio. LinqPad is good for CodeGolfing in C#.

• It's 4 characters, yes, but 5 bytes. Sep 20, 2014 at 17:37
• @JoeZ. ok, updated to reflect the number of bytes. Still way better than previous 63 and 64 bytes solutions.
– Cœur
Sep 21, 2014 at 17:45

# JavaScript, 24 bytes

A bit long, but no idea how this way got left out...