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.

Interestingly, 452-11 is the only pairing of numbers a,b where
$$(a,b)∈[32,126]\times[10,15]\land a^2-b=2014$$
The significance of those sets is that [32,126] is the set of printable ascii characters and [10,15] is the set of easily accessible Befunge numbers. I found that pair with this python program:

for a in range(32,127):
for c in range(10,16):
if (a**2-c)==2014:
print("%s,%s"%(a,c))

Or, if your interpreter supports unicode, then this works:

Befunge 98 - 5 bytes (4 chars)

Old version

cdd**e-.@

computes the number, then prints it:

cdd pushes numbers to the stack so that it is this: 12,13,13
** multiplies top three values of stack, which is now: 2028
e pushes 14
- subtracts the top two values of the stack, resulting in: 2014
. prints the numerical value
@ end of program

Older version:

"*'&("#;:a`j@a+,;

Pushes the ascii values for 2014, -10. Then prints each after adding 10 to it.

def noop x = nil; end
eval %w[we wish you a merry christmas! christmas and a happy new].map{|x|"alias #{x} noop"}*"\n"
def year!; p Time.new.year; end
we wish you a merry christmas! we wish you a merry christmas!
we wish you a merry christmas and a happy new year!

I believe the spirit of the question was to say the current year [which happens to be 2014 this year]. This solution is therefore more "portable" in time than the accepted one ;). You (and Jan Dvorak) get my vote!
–
Olivier DulacJan 2 '14 at 12:03

MATLAB, Scala (4 characters, 5 bytes)

You can take advantage of MATLAB's (and Scala's) relatively weak type system, here.
The trick is to cast a string composed only of the character ߞ (of UTF-8 code point U+07DE, which corresponds to 2014 in decimal) to an integer, using the + operator:

+'ߞ'

Byte-count details:

+ is ASCII and counts for 1 byte

' is ASCII and counts for 1 byte (but appears twice in the expression)

True, but the actual dc program is still DiBBCp (6 chars), the rest is just a way to run it.
–
danieroJan 3 '14 at 17:51

9

I was going to upvote this but it has 42 points! uses base 13 and the word BBC. How cool is that! Seems that this year we will find the question for life, universe and everithing ;-) en.wikipedia.org/wiki/Base_13. I am upvoting @daniero's comment instead and leave the answer with this magnificent 42 reputation ;-)
–
Pablo Marin-GarciaJan 12 '14 at 19:01

72 45 characters in the code; Zero character codes

This is far from the shortest answer posted, but no one has yet posted an answer that

doesn't use character codes as a substitute for numbers, and

doesn't call the system date.

Using pure math (okay, and an automatic boolean conversion) in R, from the R console:

x<-(T+T);x+floor(exp(pi)^x)*x*x-(x*x)^(x*x)/x

Prints out the number 2014. T is a pre-defined synonym for true in R. The floor and exp functions are directly available in the base package, as is the pi constant. R doesn't have an increment operator, but repeating the (x*x) turned out to be fewer characters that doing increment and decrement twice each.

Original version in Javascript (72 characters)

For the simple reason that I could test out in the console, and it doesn't mind a complete lack of whitespace:

+1. However, you claim your answer was the first answer that "doesn't use character codes as a substitute for numbers, and doesn't call the system date". That is actually false. My answer has this solution cdd**e-.@ (posted before yours) which does not make use of character codes or system date. It computes the number 2014. c,d, and e are hexadecimal number digits. a,b,...,f push (respectively) 10,11,...15 so 12 * 13 * 13 - 14 is the computation.
–
JustinJan 4 '14 at 9:19

1

@Quincunx: you're right; skimming through I didn't catch that your version was using hex digits, not character codes.
–
AmeliaBRJan 4 '14 at 15:47

I got for(int a;YES;a++){NSLog(@"%i",a);} for Cocoa Touch objective C but I can't add yet (not rated enough). It does show a 2014 eventually and it has a compiler error and is possible it may not work at all and compiled is probably about 4.2 meg - but hey.
–
Recycled SteelJan 3 '14 at 17:21

@Quincunx: It does bitwise not (0x00 changes into 0xFF, and 0x7F changes into 0x80) on every character of the string. As the string is valid identifier (anything with high bit set is an identifier character for PHP, probably to support other encodings), PHP thinks it's a constant, but because it's not defined, it treats it as a string.
–
xfixJan 1 '14 at 10:50

2

Since the question was "Now that it is 2014...", how about echo date('Y');?
–
JohnJan 2 '14 at 19:05

6

@John: Nope. If you would read the comments for the question, you would notice that OP doesn't want the to get current year as an answer. Besides, <?=date(Y); would be 11 characters, and I have solution in 9 characters.
–
xfixJan 3 '14 at 12:39

Perl - 10 characters

This solution is courtesy of BrowserUK on PerlMonks, though I've shaved off some unnecessary punctuation and whitespace from the solution he posted. It's a bitwise "not" on a four character binary string.

say~"ÍÏÎË"

The characters displayed above represent the binary octets cd:cf:ce:cb, and are how they appear in ISO-8859-1 and ISO-8859-15.

(I initially had the two strings the other way around, which required whitespace between print and RPQT to separate the tokens. @DomHastings pointed out that by switching them around I could save a character.)

Perl (cheating) - 8 characters

This is probably not within the spirit of the competition, but hdb on PerlMonks has pointed out that Perl provides a variable called $0 that contains the name of the current program being executed. If we're allowed to name the file containing the script "2014", then $0 will be equal to 2014. $0 contains a digit, so we can't use it directly, but ${...} containing an expression that evaluates to 0 will be OK; for example:

say${$|}

For consistency, let's do the hexcat-then-perl thing with that:

$ hexcat 2014
73:61:79:24:7b:24:7c:7d
$ perl -M5.010 2014
2014

I think this is cheating, but it's an interesting solution nonetheless, so worth mentioning.

Hey there, if you reverse the string and barewords, you can save a char: print"````"^RPQT. It might be possible to use say too on 5.10+ using -E instead of -e, but I don't know if that incurs a +2 penalty for different command-line args?
–
Dom HastingsJan 1 '14 at 11:54

2

It's considered acceptable to specify that you're using Perl 5 and use say for no penalty.
–
Peter TaylorJan 1 '14 at 12:04

Javascript, 18 characters

Update: the code above is fairly easy to understand by keeping in mind that btoa converts a string into another string according to a set of well-defined rules (RFC 4648). To see how the conversion works, we're going to write the input string "ÛMx" as a sequence of binary digits, where each character is rendered as its 8-bit character code.

the question mentions printing the number. I know that evaluation in a console will lead to the result being returned, but on Programming Puzzles & Code Golf it's generally expected that JS answers will include some form of IO (alert is most common).
–
zzzzBovJan 3 '14 at 16:22

@xfix, It's not this edit alone that caused me to ask that question on meta, I've seen enough code golfs where people get into disagreements over whether the dev console counts as printing, that I figured it was worth asking for a standard.
–
zzzzBovJan 4 '14 at 18:12

I optimized your math version a bit: a,b=int(e),int(pi);c=a+a;print a**(b*c-c+b)-a*a**c-a, and you can eliminate the math import altogether by making use of the fact that True in Python 2.x is identical to the integer 1 in operation, bringing it down to 50 characters: o=True;a=o+o;b=a+o;c=b+o;print a**(b*c-o)-a*a**c-a
–
WallacolooJan 8 '14 at 2:19

You can save a character if you use Python 3: ord('ߞ')
–
asmeurerJan 11 '14 at 20:24

@Quincunx It does support, however you need to have a specific encoding set to your file and append u at the end of the string (would be "ߞ"u)
–
KroltanJan 1 '14 at 16:23

2

@Kroltan Actually, I'm pretty sure the second part is not true. In Python 2, you had to prepend strings with u to say that they were unicode, but in Python 3, all strings are automatically unicode
–
murgatroid99Jan 2 '14 at 15:41