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 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.


var QUESTION_ID=17005,OVERRIDE_USER=7110;function answersUrl(e){return""+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return""+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",,t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",,i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
<script src=""></script> <link rel="stylesheet" type="text/css" href="//"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table>

Joe Z.

Posted 2014-01-01T04:57:34.797

Reputation: 16 222

5Even though numbers are ignored in brainfuck, I thought I'd post one anyway. 32 Chars: ++++++[&gt;++++++++&lt;-]&gt;++.--.+.+++. – Braden Best – 2015-04-01T21:37:33.103

1Brainfuck isn't a valid language for this challenge. – Joe Z. – 2015-04-01T22:49:22.940

I know. That's why I posted it as a comment – Braden Best – 2015-04-01T22:51:45.383

3I wonder if this question gets a small spike in popularity around New Year's. – Joe Z. – 2015-12-26T23:28:27.887

2Waiting for "Come on folks, don't you realize it's 2016?" :) – padawan – 2016-01-04T23:35:40.280

@cagirici Done. – Joe Z. – 2016-01-05T04:50:49.897

1@BradenBest It's possible to do it in 31 characters in at least two different ways:



 – Zubin Mukerjee  – 2016-02-21T17:47:16.207

@JoeZ. It's almost that time of the year again. – Ian Limarta – 2016-11-13T01:43:28.127

1possible to do the brainfuck answer in 23 bytes -[&gt;+&lt;-----]&gt;-.--.+.+++. – FinW – 2016-12-05T18:05:54.643

That language is full of language! – cascading-style – 2016-12-12T21:44:04.253

@JoeZ. We're discussing this question on meta.

– xnor – 2016-12-30T00:30:38.963



Mouse-2002, 4 bytes.

That's 4 bytes of pure, sweet ASCII.

In Mouse, the letters of the alphabet are initialised to the values 0-25. ! is the operator for printing integers, thus this prints 20 then 14 (no intermittent newline).


There's no online interpreter available, but here you will find an interpreter written in C (needing some tweaks before one can coerce gcc to compile it) and the same compiled interpreter for Win32 but which works perfectly on Linux with wine.

Here you can find the fixed version of the interpreter, which compiles.


Posted 2014-01-01T04:57:34.797

Reputation: 4 037

7Wow, this is an amazing find so much later after the challenge. And with a language so esoteric nobody here had heard of it yet! – Joe Z. – 2015-12-09T01:19:22.930


I just discovered this language today and I already love it. However, it's not purely esoteric, which makes it even better!

– cat – 2015-12-09T01:25:59.000

2BTW: this does the same thing as CJam's KE, but is actually valid because it's a language from before 2014. – Joe Z. – 2015-12-09T01:30:44.070

5The smug look on my face right now resembles that of a Fortran-77 wizard after beating some proponent of Python in a [tag:fastest-code]. – cat – 2015-12-09T01:33:09.633

1Also this solution will work until 2025 at least, until you pass U!Z!. – Joe Z. – 2016-01-11T22:24:04.313

1But by then, somebody will invent a language that prints out the Unicode value of any unrecognized token, and then the high score will be at 2 bytes forevermore. – Joe Z. – 2016-01-11T22:25:12.867

27This a game of @cat and Mouse-2002. – Digital Trauma – 2016-10-07T05:00:35.170

4@DigitalTrauma indeed :3 – cat – 2016-10-07T06:44:15.943

Running the 2007 binary using Wine on Ubuntu, the program as written produces an error message to the standard output which doesn't include the string 2014. The modified program U!O!$ works, producing 2014 and no trailing newline. – LegionMammal978 – 2017-08-11T01:50:10.613

1 237

Python, 52 bytes

print sum(ord(c) for c in 'Happy new year to you!')

Updated for 2015 thanks to @Frg:

print sum(ord(c) for c in 'A Happy New Year to You!')

Mouse over to see 2016 version:

print sum(ord(c) for c in 'Happy New Year to you!!!')

Try it online!


Posted 2014-01-01T04:57:34.797

Reputation: 8 038

5Updated: print sum(ord(c) for c in 'A Happy New Year to You!') – Frg – 2015-01-08T20:14:25.570

Uh....I get invalid syntax in 3.4? How does one run this? – jvriesem – 2015-09-16T03:57:59.520

For Python 3.x, print needs ( )'s around the expression. – dansalmo – 2015-09-17T04:23:38.823

12Congrats on being the first answer on this site to reach 1,000 upvotes. :) – Joe Z. – 2015-12-06T02:48:18.617

You don't need the space after ord(c) – Cyoce – 2016-04-02T20:52:42.060

2print sum(ord(c) for c in 'Happy New Year to You!!!!') for 2017 :D – fedorqui – 2016-07-20T13:18:46.363

Why were revisions undone for print sum(map(ord,'A Happy New Year to You!'))? It does the same thing. – Sunny Patel – 2016-08-23T16:07:29.503

3@SunnyPatel it's frowned upon to edit in golfs – Cyoce – 2016-12-07T21:59:14.413

When can haz 2017? – Pavel – 2017-01-01T05:30:08.790

2@Phoenix print sum(ord(c) for c in 'Happy New Year to You!!!!') – dansalmo – 2017-05-05T18:34:17.850

1@dansalmo Perhaps you want to add that one to the answer as well? Would be cool to see the entire list in 2025. ;) (Oh, and I took the liberty to add a TIO-link.) – Kevin Cruijssen – 2017-05-19T06:46:49.870

164You deserve the cleverness award – Carter Pape – 2014-01-01T19:49:30.683

You forgot a print somewhere. Nice one otherwise :) – Jubobs – 2014-01-01T19:49:39.370

150wow - this is so in the spirit of this question. <3 – Johannes – 2014-01-01T19:51:18.320

74I was a little surprised that it was only the 4th phrase I tried after "Happy new year!", which would have been perfect for the year 1374. – dansalmo – 2014-01-01T20:14:24.980

3Is this a rip-off of Mikael Mayer's answer in Scala, though? – SimonT – 2014-01-01T21:48:41.493

No, I did not look at anyone else's answers first. – dansalmo – 2014-01-01T21:55:12.983

10I only posted mine two hours before yours. This one is not that hard to find by oneself. – Mikaël Mayer – 2014-01-01T23:05:20.810

1Ugh, ever since I started programming in Befunge, Python looks so wordy. But since this is such an amazing solution (+1), here is the equivalent Befunge: "Happy new year to you!"aa+k+.@ – Justin – 2014-01-02T06:54:31.193

14You want terse? Ruby: p 'Happy new year to you!'.sum – histocrat – 2014-01-02T15:19:57.390

54print sum(ord(c) for c in 'HAPPY NEW YEAR To you too.') Oh wait, I'm a year late. That's 2013. – Warren P – 2014-01-02T15:31:00.903

153sum(map(ord,'Happy new year to you!')) would save 7 characters. – Gareth Rees – 2014-01-02T16:19:49.690

3Even at my best I am a bogey golfer. – dansalmo – 2014-01-02T17:04:38.730

29I created this account just to give +1! – mkoistinen – 2014-01-02T19:32:02.783

36sum(b'Happy new year to you!') in Python 3 – Kabie – 2014-01-04T12:56:14.837

5sum(bytearray('Happy new year to you!')) in Python 2.6+ – martineau – 2014-01-04T14:22:41.990

Awesome timing for awesome answer! – tumchaaditya – 2014-01-05T04:06:04.603

haha good answer, in PHP : echo array_sum(array_map('ord',str_split('Happy new year to you!'))); – Tufan Barış Yıldırım – 2014-01-05T16:32:50.093

@KevinCruijssen That wasn't their solution. fedorqui posted that solution nearly a year prior, up a few comments. – Mego – 2017-08-11T00:43:43.570

2You guys made my day! Thank you and have a great year wherever you are :) – amyassin – 2014-01-08T15:31:07.840

1Exactly 1234 upvotes at the time of the posting of this comment. – Comrade SparklePony – 2018-02-26T20:30:54.810

Printable ASCII at 32-127 means about max 62 chars, min 15. You clocked 22. I'd like to see your list of things you considered before picking this one, added to the answer. If it's code golf, how much smaller while being literate could it get...margin is 7 chars. :-) – Dr. Rebmu – 2014-03-02T23:40:29.653

1It's hard to remember exactly, but the first thing I tried was "Happy new year!", then "Happy new year!!!!!", then "Happy new year everyone!", and finally 'Happy new year to you!' – dansalmo – 2014-03-03T21:32:23.540

Mind blown! That is very clever of you sir! – rageit – 2014-07-11T14:26:44.227


Befunge 98 - 17 11 9 8 bytes


Similar to the old version, but I remembered about '

'-:* pushes 45, duplicates it, then squares it, producing 2025
b-   subtracts 11 from it, resulting in 2014
.@   prints the result, then ends the program

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:

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

Befunge 98 - 5 bytes (4 chars)


It at least works on with the following code (Befunge 93 - 6 bytes / 5 chars):


Old version


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:


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


Posted 2014-01-01T04:57:34.797

Reputation: 17 266

Can I edit the question to include my answer? – cat – 2015-12-09T00:13:33.463

76 ...what is this i don't even... – Plato – 2014-01-02T13:16:37.563

33"The language was originally created by Chris Pressey in 1993 as an attempt to devise a language which is as hard to compile as possible"... – will – 2014-01-02T15:21:41.003

1Wouldn't a:+.e.@ achieve the same? Saves a character by printing 20 and then 14. – MSalters – 2014-01-02T15:38:58.577

@MSalters That would actually print 20 14 – Justin – 2014-01-02T16:15:04.723

@Quincunx Where does it say that isn't allowed? – 11684 – 2014-01-02T16:44:13.987

7@11684 The output is rather well defined in the question. If a program printed: randomstuff2randomstuff0randomstuff1randomstuff4 I wouldn't consider it a valid solution. – Cruncher – 2014-01-02T17:45:34.097

1I agree. But at least in my native language (Dutch) spaces can be used in numbers to make numbers more readable. So I wouldn't categorise a space as 'random stuff'. – 11684 – 2014-01-02T18:20:04.453


@Plato Rather than read the wikipedia article (which only includes Befunge 93), if you want to learn about Befunge 98, read the official specs

– Justin – 2014-01-03T09:06:21.270

1By the same idea, '&amp;:f+*.@ should work as well. – MvG – 2014-01-05T19:53:30.740

@MvG yeah, I was just manually searching for short solutions, then wrote a program, then tried different methods with that program. Of course there are other short methods. – Justin – 2014-01-06T06:27:15.267

3Wiki: 'The language was originally created by Chris Pressey in 1993 as an attempt to devise a language which is as hard to compile as possible' ...but why? – CousinCocaine – 2014-01-28T20:17:54.290


Ruby, 15


Temporary ;)

Note that the section of the question

independently of any external variables such as the date or time or a random seed

was not edited in until long after I posted my answer...

Jan Dvorak offers a great alternative in the comments:

Happy = Time

But it's so unenthusiastic. I prefer:

Happy = Time
class Time; alias year! year; end!

Or even:

class Have; def self.a;; end; end
class A; def happy; Time; end; end
class Time; alias year! year; end!

And here's correct English punctuation:

def noop x = nil; end
alias a noop
alias happy noop
alias new noop
alias year! noop
def Have x

Have a happy new year!

Okay okay, I couldn't help 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; end

we wish you a merry christmas! we wish you a merry christmas!
we wish you a merry christmas and a happy new year!


Posted 2014-01-01T04:57:34.797

Reputation: 49 044

2@CoderTao It's starting to not work now. What do? – Joe Z. – 2015-01-01T01:30:15.147

4@JoeZ. Works On My Machine™. (I'm in a timezone where it's not the new year yet :P) – Doorknob – 2015-01-01T01:45:29.010

@JoeZ. Have you considered the benefits of signing our support contract? – CoderTao – 2015-01-02T09:35:58.260

158Happy = Time; – John Dvorak – 2014-01-01T08:18:20.343

2Specifically disallowed though :) – hobbs – 2014-01-01T15:33:30.480

5@hobbs No it's not; the question says nothing about this – Doorknob – 2014-01-01T16:14:29.983

11This will only work correctly some of the time. – hippietrail – 2014-01-01T16:58:06.103

112It has worked well in all tests to date – CoderTao – 2014-01-01T17:38:31.633

6I 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 Dulac – 2014-01-02T12:03:52.000

3+1 - there's no kill like overkill. :-) – Bob Jarvis – 2014-01-02T13:32:22.663

If the current year is wanted, then 13 bytes in tex: \the\year\bye – yo' – 2014-01-02T20:01:50.877

@hobbs +1 "in a way which doesn't depend on 2014 being the current year" – Ben Harold – 2014-01-07T20:47:53.063

@Ben That was edited in after I posted this answer... – Doorknob – 2014-01-07T20:55:03.440

@DoorknobofSnow maybe, but not after I posted my comment. :) – hobbs – 2014-01-08T00:07:44.567

@hobbs Actually, at the time of posting your comment there was no rule in the question stating that; check the revision history. – Doorknob – 2014-01-08T00:24:13.627

@DoorknobofSnow fine, it was in a comment by the OP. The direct answer to the question "is this allowed?" was "no." – hobbs – 2014-01-08T04:20:50.380

@hobbs This answer was posted at 5:37, and that comment was posted at 5:49. In any case, all the rules of a challenge should be in the post and not in comments anyway. – Doorknob – 2014-02-01T00:51:45.137

While it's true that the part about "doesn't depend on the current year" wasn't edited in until later, that's only because the original description assumed it to be the case that the program was supposed to actually output 2014 exactly, and not just the current year. It was inserted in as clarification against solutions like these, which were always invalid in the first place. – Joe Z. – 2014-03-24T17:26:03.510

@JoeZ The original description actually implied using the current year, as it mentioned that fact that the year was indeed 2014 and said nothing about constant output. – Doorknob – 2014-03-24T18:11:36.970


Go, 2 bytes (UTF-16)

One unicode character (2 bytes in UTF-16, 3 bytes in UTF-8 format), output 2014 as part of an error

can't load package: package : 
prog.go:1:1: illegal character U+2014 '—'


Posted 2014-01-01T04:57:34.797

Reputation: 3 960

5That's very clever, but the question requests a program that prints the number. – HelloGoodbye – 2014-01-04T15:18:37.043

34If printed error codes count, this submission should win. – ToastyMallows – 2014-01-05T15:51:53.140

6+1, brilliant. This should be the accepted answer. – asteri – 2014-01-06T19:37:55.533

25+1. The question doesn't say, "prints only the number and nothing else". – Kaz – 2014-01-14T22:31:49.557


Python, 26

print int('bbc',ord("\r"))

Darren Stone

Posted 2014-01-01T04:57:34.797

Reputation: 4 872

2Woah I almost upvoted your bbc is 2014 in base 13 but then I realized it has 42 upvotes. Perfection – User – 2015-11-01T16:04:16.617

Here is a permalink to Base 13 as of Jan 4 '14 for anyone interested. Be wary that it contains a mild spoiler to "The Restaurant at the End of the Universe".

– arekolek – 2015-11-21T13:36:40.557

50bbc is 2014 in base 13 – Darren Stone – 2014-01-01T10:50:32.950

Would've been my approach. Until I saw the accepted answer... – Kiruse – 2014-01-01T18:45:49.733

64I assume the use of the characters 'bbc' and the use of base 13 is a Douglas Adams tribute. "I may be a sorry case, but I don't write jokes in base 13." – Brian Minton – 2014-01-02T15:34:53.857

913 years ago. RIP. – Darren Stone – 2014-01-02T18:30:38.280

3IMO, this answer is in "True Pythonese" – kmonsoor – 2014-01-04T15:11:32.230

Wikipedia reference for the Douglas Adams and base-13,

– Juha Palomäki – 2014-01-04T21:50:38.240

6@BrianMinton: The use of Base 13 is probably because it's the only base between 2 and 36 that allows the number 2014 to be represented without any of the characters 0-9. – dan04 – 2014-01-05T04:25:34.217

1Coincidence? I think not! :-) – Darren Stone – 2014-01-05T04:30:05.400


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 apply the unary + operation on a string composed only of the character ߞ (of UTF-8 code point U+07DE, or 2014 in decimal). This operation implicitly converts the string to a double (in MATLAB) and to an Int (in Scala):


Byte-count details:

  • + is ASCII and counts for 1 byte
  • ' is ASCII and counts for 1 byte (but appears twice in the expression)
  • ߞ is a 2-byte UTF-8 character

Total: 5 bytes

TeX (32 26 characters, as many bytes)


An even shorter alternative (proposed by Joseph Wright) is


XeTeX/LuaTeX (13 characters, 14 bytes)

If XeTeX or LuaTeX are allowed, UTF-8 input can be used directly (as proposed by Joseph Wright):



Posted 2014-01-01T04:57:34.797

Reputation: 1 402

\let~\number~`^^T~`^^N\bye 25 chars/bytes. You IMHO count wrong, it's 25 for your solution as well. – yo' – 2014-01-02T19:46:43.473

1@tohecz I think both our solutions are actually 26-byte long. – Jubobs – 2014-01-02T19:55:35.470

1If the current year is wanted, then 13 bytes: \the\year\bye – yo' – 2014-01-02T20:03:03.350

2+'ߞ' also works in Scala (and a few other languages I imagine) – theon – 2014-01-02T21:22:41.203


dc, 6 chars

  • D pushes 13 on the stack, even tho the input radix is 10 initially
  • i changes input radix (to 13 from 10)
  • BBC is 2014 base 13.
  • p prints.

Console output:

$ dc <<< "DiBBCp"


Posted 2014-01-01T04:57:34.797

Reputation: 15 255

dc&lt;&lt;&lt;DiBBCp - a bit shorter – mpapis – 2014-01-03T17:32:44.003

10True, but the actual dc program is still DiBBCp (6 chars), the rest is just a way to run it. – daniero – 2014-01-03T17:51:17.650


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 ;-) I am upvoting @daniero's comment instead and leave the answer with this magnificent 42 reputation ;-)

– Pablo Marin-Garcia – 2014-01-12T19:01:29.187

4@PabloMarin-Garcia, unfortunatelly some unaware person broke it... Has 43 votes now. Please go back and downvote! :) – Tomas – 2014-01-14T16:07:49.657

3@Tomas Vogons always the Vogons. Resistance is futile against the intergalactic burocracy. – Pablo Marin-Garcia – 2014-01-15T00:03:07.350

1I cannot even find the D command in the man page. What does it do? Never mind... D is hex for 13. – kzh – 2014-04-28T18:40:54.373

I would upvote but you have 64 votes – professorfish – 2014-09-08T20:10:07.377

@mpapis Or dc -eDiBBCp. Same length, I think. – nyuszika7h – 2014-11-30T15:03:44.707


Morse Code, 23


..--- ----- .---- ....-


Posted 2014-01-01T04:57:34.797

Reputation: 23 198

7I claim this language isn't Turing-complete. – Joe Z. – 2015-04-08T23:50:43.007

1@JoeZ. I claim this language is not even a programming language. – SuperJedi224 – 2016-03-03T02:03:22.350

18"in any language in which numbers are valid tokens" – Doorknob – 2014-01-01T22:50:27.990

13"..---" is a valid token, in 5 strokes, for the number two, right? Just as "4" is a valid token, in three strokes, for the number "four". – DavidC – 2014-01-01T23:04:12.743

3No, the question said that numbers have to be valid in the language you're using. . and - aren't numbers. – Doorknob – 2014-01-01T23:04:50.510

1@Doorknob — David is right. – Nicolas Barbulesco – 2014-01-02T23:11:52.630

7Braille could be shorter :) – Dr. belisarius – 2014-01-03T04:40:20.590

26Good point. Btw, I was relieved that no one asked how I get Morse Code to run on my computer. – DavidC – 2014-01-03T05:14:31.740


@DavidCarraher What do you mean? I naturally assumed you used this repo to decode it. Everyone's doing it...

– Michael J. Calkins – 2014-01-04T20:28:08.287

6@MichaelCalkins Of course. How silly of me. – DavidC – 2014-01-04T20:32:38.570

5This isn't compiling for me... – Embattled Swag – 2014-01-10T17:15:10.430


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:


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:


run in your console and it will print back the number 2014.

Props to xkcd (and also) for getting me to think about exp(pi): e to the pi Minus pi

P.S. If you can make the same algorithm shorter in a different language, post a comment with it.


Posted 2014-01-01T04:57:34.797

Reputation: 1 021

4+1 for the "purity of purpose" of your solution. – Joe Z. – 2014-01-01T18:27:11.893

1o=!"";(o+o)+""+(o-o)+(o+o-o)+(o+o+o+o) – Kernel James – 2014-01-02T10:32:28.360

225 bytes: alert('ߞ'.charCodeAt()) – oberhamsi – 2014-01-02T14:13:35.793


+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.

– Justin – 2014-01-04T09:19:08.433

This wasn't the first answer to not use character codes; I have several earlier ones. – Timtech – 2014-01-04T12:39:32.350

1@Quincunx: you're right; skimming through I didn't catch that your version was using hex digits, not character codes. – AmeliaBR – 2014-01-04T15:47:02.527

o=+!'';t=o+o;''+t+(+!o)+o+(t+t), a bit smaller than @kernel-james one – Ricardo Panaggio – 2014-01-05T13:08:34.020

R code with 38 characters x=T+T;y=x*x;x+floor(exp(pi)^x)*y-y^y/x – djhurio – 2014-01-07T11:12:28.750

Nice catch, @djhurio. – AmeliaBR – 2014-01-07T16:42:05.293

I also like @KernelJames version (and Ricardo's improvement) though they really qualify as a completely different method rather than an improvement on mine -- I assume the "protected" status wasn't letting you post? – AmeliaBR – 2014-01-07T16:44:51.883

two k implementations of this algo, both 39 chars: 1: -_-(x*p*p:exp acos@-#`)-f*x*x*x:f*f:#``; 2: f+(x*_p*p:exp acos@-#`)-f*x*x*x:f*f:#``. I can't seem to squeeze it any further at the moment.... – Aaron Davies – 2014-01-22T20:25:24.240

and here it is in APL in 31 chars (which i'm quite new to, so i'm sure it can be improved--particularly the hacky generation of the 2 constant): ⌈(x×p×p)-f×x×x×x←f×f←⍴⍕⌊p←*○~⊃⍬ – Aaron Davies – 2014-01-22T20:48:53.953


Scala REPL

34 29 characters.

+"Happy new year to you!".sum

Well ok if you really want it golfed with any chars, you can use:

'@'*' '-'"'



which have 11 and 22 chars respectively.

Mikaël Mayer

Posted 2014-01-01T04:57:34.797

Reputation: 1 490

4Interesting idea, even if it's not particularly golfed. But the string itself makes it more interesting, than something using high bytes, or something like that. – xfix – 2014-01-01T19:32:46.910

I added a golfed version. – Mikaël Mayer – 2014-01-01T20:12:55.343

You could save a couple characters from the toInt like this: +"Happy new year to you!".sum Test

– theon – 2014-01-02T21:26:44.283

Updated. I did not know that + could also be a prefix. – Mikaël Mayer – 2014-01-03T09:49:16.023


PHP, 9 bytes

xxd needed because of binary data (so copying and pasting it would be easier). May return E_NOTICE, but it doesn't really matter, does it?

~ $ xxd -r > 2014.php
0000000: 3c3f 3d7e cdcf cecb 3b                   <?=~....;
~ $ php 2014.php

Alternatively, save this using ISO-8859-1 encoding.



Posted 2014-01-01T04:57:34.797

Reputation: 9 392

Why not &lt;?=~ÍÏÎË instead? – Ismael Miguel – 2015-01-03T18:46:06.693

@IsmaelMiguel: I guess (if you save it using ISO-8859-1). – xfix – 2015-01-03T20:13:08.417

@Quincunx: Uploading this was relatively tricky, but here is Ideone -

– xfix – 2014-01-01T10:47:45.083

1This looks interesting; what does it do? – Justin – 2014-01-01T10:48:24.727

7@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. – xfix – 2014-01-01T10:50:08.657

2Since the question was "Now that it is 2014...", how about echo date('Y');? – John – 2014-01-02T19:05:13.307

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, &lt;?=date(Y); would be 11 characters, and I have solution in 9 characters. – xfix – 2014-01-03T12:39:32.380


C, 33 bytes

main(){printf("%d",'A'*' '-'B');}

Sudharsan Mohan

Posted 2014-01-01T04:57:34.797

Reputation: 821

@JonathonReinhart multi-character literals are entirely implementation-defind. – FUZxxl – 2015-04-08T12:14:05.213

17How annoying that the prime factorization of 2014 requires ASCII 5! – Ben Jackson – 2014-01-01T08:56:06.520

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 Steel – 2014-01-03T17:21:14.703

main(){printf("%d",'\a\xde');} – mjy – 2014-01-05T15:07:12.807

1@mjy Byte order of multi-character literals is not guaranteed. – Jonathon Reinhart – 2014-01-05T22:14:53.000


Mathematica, 14 characters (or 15 if you count the bitmap as a character)

TextRecognize@enter image description here

Michael Stern

Posted 2014-01-01T04:57:34.797

Reputation: 2 427

45Actually, you should count bytes so it's 14 + the size of the bitmap image. – Sylwester – 2014-01-01T18:46:16.863

18The bitmap would probably be 7,357 characters, really. – Joe Z. – 2014-01-01T18:46:25.163

3Also, I believe some of the bytes in the image fall into the \d range. Namely, if it's the GIF, then the header itself is guaranteed to contain some. – John Dvorak – 2014-01-01T18:49:19.760

13You are all killjoys. Fine, use First@ToCharacterCode@"ߞ" for 25 characters, 26 bytes. – Michael Stern – 2014-01-01T18:59:19.753

@MichaelStern Yup, that's been done allready. – Ajasja – 2014-01-01T19:08:36.677

@Ajasja only after I fixed it. The old solution as given produced a list of answers rather than '2014' as specified by the problem. – Michael Stern – 2014-01-01T19:21:39.630


As a bonus, here's a Mathematica solution in 30 characters --URLFetch@""

– Michael Stern – 2014-01-01T19:42:52.623


I liked this answer so much I made it into its own question:

– Charles – 2014-01-05T06:17:39.503


Javascript, 23 bytes

Uses Base 64 Conversion


23 chars (16 with atob by itself)


alert("MMXIV") // ;)


Posted 2014-01-01T04:57:34.797

Reputation: 581

alert("ߞ".charCodeAt()) – programmer5000 – 2017-04-10T12:56:38.923

26MMXIV has no characters in common with 2014, last I checked... // ;) – Joe Z. – 2014-01-01T06:45:20.290

22The ancient Romans might disagree. The first one produces 2014 though, in modern English. – logic8 – 2014-01-01T06:48:01.030

1Your first one doesn't output though... – Doorknob – 2014-01-01T16:14:52.157

1if you open the console in chrome, paste it and hit enter it returns the value - I'll add an alert to it as its longer than others anyway. – logic8 – 2014-01-01T17:54:52.677

4@logic8: Nice one +1. Another JavaScript version which also works: (4 bytes) [!+[]+!+[]]+[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]] - alert([!+[]+!+[]]+[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]]); Though I'm not sure it meets Joe Z's requirements. – Nope – 2014-01-03T15:03:46.710

@FrançoisWahl, Now that's cool! Nice one. – logic8 – 2014-01-03T19:20:41.640

Or go the other way btoa("ÛMx") for 11 characters – phil mccull – 2014-01-03T21:35:49.513

Just so you know, atob("MjAxNA==") returns "2014" (a string). +atob("MjAxNA==") returns a number. Doesn't matter for alert, though. – Pascal – 2014-01-05T15:01:12.400

@logic8 The ancient Romans would probably find it quirky as they didn't use generally use subtractive notation (e.g. IV for 4). – Peter Cooper – 2014-01-05T16:56:30.013

1Here's another javascript base one: alert(parseInt('bbc',+[]+'xd')) – kybernetikos – 2014-01-05T20:03:23.183

@PeterCooper: That's interesting. Would the standard have been "IIII" then? – logic8 – 2014-01-05T21:54:58.940

1@logic8 You can omit the equals signs to get 21 chars – gengkev – 2014-01-12T21:04:22.757


Python3.4.0b2 (0 bytes)

% python3.4  
Python 3.4.0b2 (v3.4.0b2:ba32913eb13e, Jan  5 2014, 11:02:52) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.


Posted 2014-01-01T04:57:34.797

Reputation: 3 960

1Also works in Python 3.4.2. – Erik the Outgolfer – 2016-09-14T17:56:59.917

This won't work once people update their version of Python 3 a year from now. – Joe Z. – 2014-01-11T22:51:29.427

18That's why I mentioned python3.4.0b2, It wont happen twice. Its release date, not system date. – YOU – 2014-01-12T03:18:35.937

4This made me smile! – Matt Fletcher – 2014-08-02T11:24:40.330


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.


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.

Here's the entire script in hex, plus an example running it:

$ hexcat ~/tmp/
$ perl -M5.010 ~/tmp/

Perl (without high bits) - 14 characters


This uses a bitwise "or" on the two four-character strings "RPQT" and "````" (that is, four backticks).

$ ~/tmp/
$ perl -M5.010 ~/tmp/

(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:


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

$ hexcat 2014
$ perl -M5.010 2014

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


Posted 2014-01-01T04:57:34.797

Reputation: 1 213

2Hey 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 Hastings – 2014-01-01T11:54:38.850

2It's considered acceptable to specify that you're using Perl 5 and use say for no penalty. – Peter Taylor – 2014-01-01T12:04:27.927

@DomHastings, personally I think if you're going to do it with "-e" or "-E", I'd say that you should then have to include the entire command, including "perl -E" in your character count. – tobyink – 2014-01-01T13:35:50.170

@PeterTaylor, say is a syntax error in Perl 5 unless you explicitly write a pragma to enable it such as use v5.10 or use feature 'say'. In Perl 6 it's enabled automatically. – tobyink – 2014-01-01T13:37:11.443

1Relevant meta answer – Peter Taylor – 2014-01-01T14:24:22.860

4You may also save another byte by using string literals that don't require quotes, such as say ABCD^srrp. – primo – 2014-01-09T17:56:10.053


Ruby, 20

p 'bbc'.to_i ?\r.ord

Explanation: bbc is 2014 in base 13. Shorter than Python. Not as short as Forth.

Darren Stone

Posted 2014-01-01T04:57:34.797

Reputation: 4 872

(late comment) Can you do i? instead of i ?? – Erik the Outgolfer – 2016-06-18T15:56:43.867

21"Nobody writes jokes in base 13!" – Jean-Michaël Celerier – 2014-01-01T12:21:45.560


3+1 just for base 13! – Thorbjørn Ravn Andersen – 2014-01-01T20:53:30.440

1p 'ߞ'.ord for a fully functional program, 'ߞ'.ord inside irb. Works on 1.9+ – Ricardo Panaggio – 2014-01-03T02:37:51.457

1Without "strange" unicode characters: ?-*?--?\v (45 * 45 - 11) (Ruby 1.8) – Ricardo Panaggio – 2014-01-03T02:45:54.963

One character smaller: ?.*?.-?f (46 * 46 - 102) (Ruby 1.8 only again) – Ricardo Panaggio – 2014-01-03T02:58:02.487

How is the base 13 indicated in the print? – Recycled Steel – 2014-01-03T17:13:51.193

@RecycledSteel, to_i takes a base parameter. I'm passing it 13 since that's the ordinal value of a carriage return (\r). – Darren Stone – 2014-01-03T17:53:56.633

z=''.to_i;o=Math.cos(z).to_i;t=o+o;"#{t}#{z}#{o}#{t+t}" without relying on charcodes – Ricardo Panaggio – 2014-01-05T13:13:08.290

@RicardoPanaggio, those are some sweet answers. You should submit. I'm going to leave mine as-is, simply for the BBC - Base-13 - Douglas Adams connections. :-) – Darren Stone – 2014-01-05T16:42:45.897


Powershell, 9


ߞ (U+07DE NKO LETTER KA) is counted as two bytes according to the code-golf tag info.

[""] returns the first character from the string ("" is converted to 0). The unary plus opeartor (+) converts the character to an integer.

Danko Durbić

Posted 2014-01-01T04:57:34.797

Reputation: 9 476


According to, it should count as 9 characters.

– xfix – 2014-01-01T11:15:25.223

@GlitchMr, thanks, I've corrected my answer. – Danko Durbić – 2014-01-01T11:22:35.520

3The [''] is a nice trick. I usually used [char] but that's indeed shorter :) – Joey – 2014-01-08T08:57:12.403


Javascript, 18 characters


Update: in ES6, using a template literal can save two characters:


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.

Input character          |        Û |        M |        x
Character code (decimal) |      219 |       77 |      120
Character code (binary)  | 11011011 | 01001101 | 01111000

After reorganizing the binary digits in the last row in groups of 6, we get the binary representation of 4 new numbers, corresponding to the Base64 indices of the 4 characters in the string "2014".

Base64 index (binary)  | 110110 | 110100 | 110101 | 111000
Base64 index (decimal) |     54 |     52 |     53 |     56
Output character       |      2 |      0 |      1 |      4

As per HTML specification, the output characters can be retrieved from their Base64 indices according to this table:

If you don't care about the details, you could let the browser do the calculations for you and find out that "ÛMx" is the result of evaluating atob('2014') in Javascript.


Posted 2014-01-01T04:57:34.797

Reputation: 607

Or in a function expression (allowed by default) x=&gt;btoa\ÛMx`` – programmer5000 – 2017-04-10T13:03:21.077

@programmer5000 Times have changed but the consensus in 2014 was to use alert. You can find the discussion in the link in xfix's comment. – GOTO 0 – 2017-04-10T13:24:59.590

the question mentions printing the number. I know that evaluation in a console will lead to the result being returned, but on [CodeGolf.SE] it's generally expected that JS answers will include some form of IO (alert is most common). – zzzzBov – 2014-01-03T16:22:07.573

@zzzzBov Yes, my original answer included an alert call.

– GOTO 0 – 2014-01-03T17:21:37.743

It lists Community as having removed the alert. I wonder if the standards have changed for JS codegolf or whether it's just a change that was adopted by Community.

– zzzzBov – 2014-01-03T17:28:47.633

@zzzzBov: It was a change by anonymous user accepted by SHiNKiROU and luser droog. Anyway, this edit triggered a discussion on Meta (

– xfix – 2014-01-04T11:19:20.153

@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. – zzzzBov – 2014-01-04T18:12:51.173

I'd love to have an explanation of how this works. – DA. – 2014-01-08T01:23:26.880

@DA. I added a short explanation. – GOTO 0 – 2014-01-09T18:38:02.440

@GOTO0 thank you! – DA. – 2014-01-10T07:31:17.187

if functions are allowed instead of full program: _=&gt;btoa'ÛMx' which is 13 bytes (the ' symbols should be `, but i can't because of the limitations in comments) – Brian H. – 2017-11-15T14:22:35.783


Scala REPL - 6 chars


(## is Scala's symbol meaning hashCode, and the Java string "?=" hashes to 2014.)

Scala REPL - 4 chars, 5 bytes


Math on our favorite unicode character produces an Int.

Rex Kerr

Posted 2014-01-01T04:57:34.797

Reputation: 813


Yet another GolfScript entry, 9 printable characters

I believe this is shorter than any of the printable GolfScript entries so far:


(Peter Taylor's 7-char entry beats it, but includes non-printable control characters.)

I call this the "that's so last year!" entry, because what it actually does is generate the number 2013 in 8 chars, as 33 × 61, and then increments it by one. ;-)

Ilmari Karonen

Posted 2014-01-01T04:57:34.797

Reputation: 17 947

You win (for ascii golfscript) – aditsu – 2014-01-01T16:39:58.520


C (31)

main(){printf("%o",' b'/'\b');}

C (32)

main(){printf("%x%o",' ','\f');}

C (30)

main(){printf("%x",' j'^'~');}

C (30)



Posted 2014-01-01T04:57:34.797

Reputation: 2 353

The most recent edit included a variation of code which breaks the rule of including numbers in the code. It uses the number "5". – Albert Renshaw – 2017-01-29T22:22:21.470

How about just "%x" and 'b'*'S' ? That's 8212 dec or 2014 hex. Saves one char one literal and two on format string. – MSalters – 2014-01-02T15:26:11.103

@MSalters No, 'b'*'S' is 8134. The prime factorization of 8212 is 222053, so I don't see an easy way to produce it. – fredoverflow – 2014-01-02T16:14:17.073

Bah, checked with integer division that 8212/'b' == 'S' :( – MSalters – 2014-01-02T16:37:48.373

and octal doesn't work either (02014=1036=37*28, 28 is unprintable) – MSalters – 2014-01-02T16:44:38.807

@MSalters The octal was a nice hint though, see my new 31 solution ;) – fredoverflow – 2014-01-02T17:34:25.427

1@FredOverflow what about my 28 char solution?

main(){puts(DATE+'\a');} – Arunprasad Rajkumar – 2014-01-08T05:18:49.050

@ArunprasadRajkumar Will it work in the next year too? (eg. display "2014") – Spook – 2014-01-08T11:41:30.017

Your last solutions employs implementation defined behavior and is likely invalid. – FUZxxl – 2014-09-22T12:21:50.593


GolfScript, 14


How it works: ASCII goes like this:


So, this takes the ASCII codes of each character, subtracts five, and sticks it in a string.

{...}% yields an array of the characters of a string mapped, when given a string as an argument. So, it increments each character by 5 () means increment).


Posted 2014-01-01T04:57:34.797

Reputation: 49 044

The CJam version of this: "-+,/"_,)f+. :) (Then again, CJam has KD.) – Martin Ender – 2014-12-18T18:38:07.483

The + at the end is unnecessary. Also, rather than increment 5 times, just add five. Total savings: 4 chars. '-+,/'{5+}% – Justin – 2014-01-01T10:42:14.760

13@Quincunx, 5 is a number. – Peter Taylor – 2014-01-01T10:48:18.453

@Quincunx Thanks, edited – Doorknob – 2014-01-01T13:32:34.893

4@PeterTaylor I keep forgetting. – Justin – 2014-01-01T16:43:40.767

Clever solution – Sumurai8 – 2014-01-02T07:38:38.173


Forth, 14

'> '" * '^ - .      

Darren Stone

Posted 2014-01-01T04:57:34.797

Reputation: 4 872

1Can you explain how this works? – ProgramFOX – 2014-01-01T11:04:58.047

1I'm expressing integer constants as character literals using their ordinal (ASCII) values. So this is: 62 34 * 94 - . If you don't speak Forth, this means print (62 * 34 - 94). – Darren Stone – 2014-01-01T11:14:09.887

Forth (Gforth 0.7.0), 5 bytes, 4 chars: 'ߞ . It prints the character. – 18446744073709551615 – 2014-01-09T11:03:33.333


Python, 32 chars

print ord(',')*ord('-')+ord('"')

Probably possible to reduce it using the 2014 th Unicode char ߞ, but I didn't try.

Quincunx notes that

a=ord('.');print a*a-ord('f')

is shorter by three chars.

Bruno Le Floch

Posted 2014-01-01T04:57:34.797

Reputation: 1 051

The unicode version works, at least in Python 3 with IDLE: print(ord("ߞ")). It does not appear to work in Python 2; Python 2 probably does not support unicode. – Justin – 2014-01-01T09:59:19.137


Also, with your version, a=ord('.');print(a*a-ord('f')) is 2 chars shorter.

– Justin – 2014-01-01T10:06:58.723

@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) – Kroltan – 2014-01-01T16:23:41.703

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 – murgatroid99 – 2014-01-02T15:41:38.903

@murgatroid99 Ah, sorry. It's been a while since I used python, and my brain remembered about C-style float literals (1453f) – Kroltan – 2014-01-02T18:38:45.143

1Similar as commented above, without unicode print ord('.')**2-ord('f') is slightly shorter. – MLS – 2014-01-07T16:45:31.720


APL (6 bytes, 4 chars)


Only works this year though.

Why it works:

2014 1 1 11 58 5 811

Without relying on the system date, it's 10 bytes (7 characters):



Posted 2014-01-01T04:57:34.797

Reputation: 29 024

5Unfortunately, answers that only work for this year are invalid. – Joe Z. – 2014-01-01T15:34:19.607

I don't know APL: is that square box an APL char, or am I missing a font representation (Chrome) ? – Carl Witthoft – 2014-01-01T16:24:33.457

@JoeZ.: The question doesn't say that but I've added one that doesn't rely on it being 2014. – marinus – 2014-01-01T17:12:18.843

4@CarlWitthoft: It's called a quad (), it's supposed to look like that. – marinus – 2014-01-01T17:12:48.470


Python 32 10 bytes, 91 85 (66 with math imported by default) bytes pure math

Had some fun writing this:

my_lst = []
for i in range(33, 126):
    for j in range(i, 126):
        if 2014 - 126 < i * j < 2014 - 33:
            if j not in range(48, 58):
                my_lst.append("ord('" + unichr(i) +
                              "')*ord('" + unichr(j) +
                              "')+ord('" + unichr(2014 - i * j) + "')")

for val in my_lst:
    print val, '->', eval(val)

Prints all the possible ways I can write 2014 using Bruno Le Floch's method (32 chars):

ord('!')*ord(':')+ord('d') -> 2014
ord('!')*ord(';')+ord('C') -> 2014
ord('!')*ord('<')+ord('"') -> 2014
ord('"')*ord(':')+ord('*') -> 2014
ord(')')*ord('/')+ord('W') -> 2014
ord('*')*ord('-')+ord('|') -> 2014
ord('*')*ord('.')+ord('R') -> 2014
ord('*')*ord('/')+ord('(') -> 2014
ord('+')*ord(',')+ord('z') -> 2014
ord('+')*ord('-')+ord('O') -> 2014
ord('+')*ord('.')+ord('$') -> 2014
ord(',')*ord(',')+ord('N') -> 2014
ord(',')*ord('-')+ord('"') -> 2014

But this is obviously redundant, so if your interpreter is set to utf-8 by default, then all it takes is:

>>> ord(u'ߞ')

Also, thanks to AmeliaBR (for the idea), I tried my best to implement a pure math version:

from math import*
a,b,c=int(e),round(e),ceil(pi);print int(a**(b*c-(c-b))-a*a**c-a)


Posted 2014-01-01T04:57:34.797

Reputation: 86

@JoachimIsaksson A digit is no number ;) – Mega Man – 2016-08-26T18:50:20.023

Here is an optimized math version (42 characters) a=True;a+=a;print(a&lt;&lt;a*a*a)*a*a-(a&lt;&lt;a*a|a) – Phylliida – 2017-03-30T06:12:54.673

ord(',')**2+ord('N') – MLS – 2014-01-07T16:42:31.893

5@MLS Well, that has a digit in it :) – Joachim Isaksson – 2014-01-07T23:00:54.293

2I 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 – Ponkadoodle – 2014-01-08T02:19:09.820

You can save a character if you use Python 3: ord('ߞ') – asmeurer – 2014-01-11T20:24:24.870


Java - 77 75 characters

75 characters if print is added in a class with the main method:

class C{public static void main(String[]a){System.out.print('#'*'<'-'V');}}

It means 35*60-86 which is equal to 2014

True Soft

Posted 2014-01-01T04:57:34.797

Reputation: 675

2I like your formula. – Johannes – 2014-01-01T23:30:21.640

7This actually needs to be longer, because the class definition needs to be in it to run. Shortest way I know (with Java 6):class a{static{System.out.println('#'*'&lt;'-'V');}} – Justin – 2014-01-02T00:29:03.230

1@Quincunx, with Java 7, a main method is needed – True Soft – 2014-01-02T20:53:12.023

2@TrueSoft Note I said "with Java 6". You should choose the shortest Java possible. – Justin – 2014-01-03T00:43:51.107

2You can remove 'ln' in println to reduce chars... – laksys – 2014-01-03T10:22:21.343

@laksys, thanks for the tip :) – True Soft – 2014-01-03T12:01:09.530

@Quincunx, a class without main() would throw an error at runtime, and I don't think it's ok to put that as an answer. – True Soft – 2014-01-03T21:33:02.203

Another fun way would have been value of "?=".hashCode(). Not shorter, just fun. – MickJ – 2014-01-03T22:26:58.027

@TrueSoft see

– Justin – 2014-01-03T22:40:38.700

I can improve this answer (to 72 chars) but I can't find the answer button on this StackExchange.. weird :S – javatarz – 2014-01-08T10:56:26.543

You can shave 4 bytes off the expression if you're willing to use non-printables: 'j'*'' (106*19). – Boann – 2014-01-08T19:30:53.063

Read it and weep: class C{public static void main(String[]a){System.out.print(0xFBCA/' ');}} – Hot Licks – 2014-01-09T01:28:24.660

My solution ( comes at 69 chars. Beats @HotLicks' solution by 5 chars :)

– javatarz – 2014-01-09T05:17:32.453

@JAnderton - Of course, that's a non-ASCII solution. Different category. – Hot Licks – 2014-01-09T12:10:56.963

1@HotLicks 0x has a digit. – Boann – 2014-01-09T18:28:37.350

@Boann - Drat!!! Forgot about that. – Hot Licks – 2014-01-09T18:58:02.357


R (20 character)

@popojan (he is not allowed to post an answer here yet) has provided the solution within 20 characters.



> sum(T+T:exp(T+pi))-T
[1] 2014

R (22 character)

Anonymous user has suggested shorter solution.


2014 is BBC in base 13. pi*pi+pi (=13.0112) is treated by R in this context as the integer 13. Output:

> strtoi("bbc",pi*pi+pi)

R (30 character)

Thanks to @Tomas!



> cat(a<-T+T,T-T,T/T,a*a,sep="")

R (31 character)


Inspired from the answer by AmeliaBR. Output:

> cat(T+T,T-T,T/T,T+T+T+T,sep="")


Posted 2014-01-01T04:57:34.797

Reputation: 1 013

Wow, +1! And I hoped my roman numerals solution will be the best... :( ;-)

– Tomas – 2014-01-14T15:35:38.607

The variants below can be made shorter: cat(a&lt;-T+T,T-T,T/T,a^a,sep="") (30 chars), paste0(aT+T,T-T,T/T,a^a) (26 chars) – Tomas – 2014-01-15T10:16:19.117

@Tomas, the function paste0 is not allowed, as it contains the symbol 0. Your solution makes 30 characters if using cat. – djhurio – 2014-01-21T10:47:43.640

create file 2014 in current directory and write list.files() - 12 characters – Zbynek – 2014-01-31T17:00:16.177

@Zbynek, I expect your solution not to be valid in the general scope of codegolf rules. – djhurio – 2014-02-01T09:19:04.050


CJam - 2


K and E are variables preset to 20 and 14.
I created CJam in 2014 so it's ok if it doesn't qualify.


Posted 2014-01-01T04:57:34.797

Reputation: 20 689


GolfScript, 10 8 7 chars

This solution contains non-printable characters. As xxd output:

0000000: 2714 0e27 7b7d 2f                        '..'{}/

As base 64:


Unpacks the ASCII codes for characters 20 and 14 and prints those numbers without any separation.

To actually generate the number 2014, I'm currently at 8 chars:

0000000: 2713 6a27 7b2a 7d2a                      '.j'{*}*


Takes a string containing characters with ASCII values 19 and 106 and multiplies them to get 2014.

Peter Taylor

Posted 2014-01-01T04:57:34.797

Reputation: 37 961

Does it really take 3 characters to output the ascii codes for a string? That's sad :/ – aditsu – 2014-01-01T12:08:20.400

Printing 20 and 14 without separation is acceptable. – Joe Z. – 2014-01-07T01:37:36.127

3I guess this can be actually shortened to 6 chars with {xy}.* where x and y represent 20 and 14 in ASCII. – Vereos – 2014-01-08T17:42:28.863

@Vereos, I somehow missed seeing your comment earlier. Very nice, and sufficiently different that it's worth posting as a separate answer. – Peter Taylor – 2014-03-05T14:24:17.860

Alright, I will :) – Vereos – 2014-03-05T15:05:15.673


Haskell, 23 characters, 24 bytes

main=print$fromEnum 'ߞ'

That's U+07DE N'Ko letter KA


Posted 2014-01-01T04:57:34.797

Reputation: 4 569

According to, it has 24 characters.

– xfix – 2014-01-01T11:17:32.700

2Methinks that's 23 characters, @GlitchMr, though it may be 24 bytes. – TRiG – 2014-01-01T18:18:14.330

@TRiG: Well, yes. The info page says that "If you use Unicode, byte count should use UTF-8." – xfix – 2014-01-01T19:06:36.030


Mathematica, 47 bytes

Total@ToCharacterCode@"Happy New Year for all!"



Posted 2014-01-01T04:57:34.797

Reputation: 341

If you remove the space between All and !, you can make All lowercase. – Joe Z. – 2014-01-03T00:33:11.340

@JoeZ. Yes!.. tks – Murta – 2014-01-03T00:35:40.177

1That's pretty awesome. – BrainSlugs83 – 2014-01-13T04:17:19.753


Mathematica, 23 bytes


(Using the 2014 unicode char. Credit for Tr goes to alephalpha)


Mathematica, 46 bytes (pure math)


idea taken from here.


Posted 2014-01-01T04:57:34.797

Reputation: 340

2 bytes "=[LongDash]" where "[LongDash]" is replaced to character and wolfram alpha returns 2014. – Margus – 2016-03-03T16:31:31.013

1That returns a list. To return only the desired string without using any numbers, try First@ToCharacterCode@"ߞ". That's 25 characters, 26 bytes. – Michael Stern – 2014-01-01T19:01:26.010

2@MichaelStern Hmm I would think a List is OK. – Ajasja – 2014-01-01T20:39:59.370

Nope, has to be the number itself. – Joe Z. – 2014-01-02T15:00:31.773

@MichaelStern Tr@ToCharacterCode@"ߞ". – alephalpha – 2014-01-02T15:59:10.963

@MichaelStern Thanks, great idea! JoeZ: Oh well:) – Ajasja – 2014-01-02T17:34:46.950


I and others have posted shorter Mathematica solutions to this challenge, but here are two methods that I don't believe have been tried in any of the other examples, in any languages.

Mathematica, 27 characters / 27 bytes

FromDigits["MMXIV", "Roman"]

Mathematica, 37 characters / 37 bytes

(ToString /@ FromDigits /@ {"K", "E"}) <> ""

and the following 58 character variation

FromDigits[Flatten[IntegerDigits /@ FromDigits /@ {"K", "E"}]]

Michael Stern

Posted 2014-01-01T04:57:34.797

Reputation: 2 427

37 chars:(ToString /@ FromDigits /@ {"K", "E"}) &lt;&gt; "" By the way, why does FromDigits["K"] return 20?? – DavidC – 2014-09-23T02:25:03.523

@DavidCarraher Ah, 37 characters indeed, thank you. As for FromDigits["K"], "0"->0, "1"->1, "2"->2, "3"->3, "4"->4, "5"->5, "6"->6, "7"->7, "8"->8, "9"->9, "A"->10 etc. – Michael Stern – 2014-09-23T10:16:45.777


Mathematica (24)

Found by randomly generating expression trees. TraditionalForm chops 5 characters for the floor symbol but I think rich text doesn't count.

Floor[π E(Sin@E+E^E)E^E]


Posted 2014-01-01T04:57:34.797

Reputation: 3 749

1+1 Very nice! Pi counts as two chars (takes two bytes in UTF8, so it's 25 bytes). You can get it to 22 bytes by ⌊π*E(Sin@E+E^E)E^E⌋ (as you mentioned). – Ajasja – 2014-01-03T13:53:20.010


EXCEL, 24 characters:



Posted 2014-01-01T04:57:34.797

Reputation: 151

Why not =COLUMN(T1)&amp;COLUMN(N1)? – Neil – 2016-03-04T09:47:37.910

@Neil because that has digits. – Titus – 2016-12-05T21:01:55.463

you can shorten to 16 bytes by using =COLUMN(BYL:BYL) – Taylor Scott – 2017-07-12T10:06:40.813

1How does this even work? – Timtech – 2014-01-07T23:13:34.820

2@Timtech T:T and N:N define an entire column, and COLUMN returns the column number of the reference passed in (of its top left cell, IIRC). &amp; is string concatenation. – John Dvorak – 2014-01-08T03:15:11.760

Good job there :) – Timtech – 2014-01-08T11:50:51.537

How about the sheet references to shorten it even more? – Konrad Viltersten – 2014-01-19T18:19:34.333


Java (68)

Solution 4: 68 chars (Thanks @radiodef))

class C{public static void main(String[]a){System.out.print(+'ߞ');}}

Solution 3: 69 chars (Thanks @Kamran)

class C{public static void main(String[]a){System.out.print(~~'ߞ');}}

Solution 2: 71 chars

class C{public static void main(String[]a){System.out.print('޾'+' ');}}

Solution 1: 72 chars

class C{public static void main(String[]a){System.out.print((int)'ߞ');}}

<3 Unicode.

Solution Derivation Technique: Copy the output from the following line and convert that character back to int for your a working solution.



Posted 2014-01-01T04:57:34.797

Reputation: 273

1n-&gt;+'ߞ' for 8 bytes (7 characters), since lambdas are appropriate equivalents of a program. – Olivier Grégoire – 2017-08-09T08:15:56.280

I'm pretty sure that 1 is a digit and hence forbidden. – Peter Taylor – 2014-01-09T10:14:29.143

2Mine is better, without any numbers, and has 69 character.

class C{public static void main(String[]a){System.out.print(~~'ߞ');}} – Kamran – 2014-01-09T10:29:32.043

Didn't think of that. Nice solution @Kamran – javatarz – 2014-01-09T11:16:53.513

4By the way instead of the double complement, you can basically cheat and use the useless "positive" operator. System.out.print(+'ߞ'); All it will do is promote to int. – Radiodef – 2014-01-09T17:01:12.847

1Note: This current answer produces text, not a Number object, as the question requested. – djangofan – 2014-01-10T00:55:47.067

@Radiodef Updated the answer! Thanks for the suggestion. – javatarz – 2014-01-10T05:34:06.963

@djangofan not sure if @JoeZ. meant it to be a number specifically. Either way, I don't think your statement is completely true. The only way Java can bit compliment the value is to consider it an Integer (or int). Here's a SSCCE that proves my point: Object o = ~~'ߞ'; System.out.println(o.getClass()); the output to which is class java.lang.Integer – javatarz – 2014-01-10T05:38:35.153

@PeterTaylor Thanks for the note. I removed that solution. The current solution, you'll find, is compliant to requirements (to the best of my knowledge ;)) – javatarz – 2014-01-10T05:39:36.830

@OlivierGrégoire In that case you no longer need the +. Simply o-&gt;'ߞ' will be enough, if the return-type is an int. Try it online. But the challenge states "Your task is to make a program", so I would just leave it as is. Maybe changing class C{public static void main to interface C(static void main to save a byte, by going from Java 7 to 8.

– Kevin Cruijssen – 2017-09-19T12:11:10.033

1Tip: you can use enum C{ instead of Class C{ Some IDEs think its a compiler error but it compiles flawlessly. that can result in another byte shaved off – masterX244 – 2014-03-05T15:40:11.537



ϯ has the numerical value 1007 in Unicode encoding.

as compiler message during compilation (20 chars)


runtime version (45 chars)

import std.stdio;void main(){write('ϯ'+'ϯ');}


Posted 2014-01-01T04:57:34.797

Reputation: 111

(late comment) Can you do pragma(msg,'ߞ'); and import std.stdio;void main(){write('ߞ');}? NOTE: ߞ IS U+07DE (2014). – Erik the Outgolfer – 2016-06-18T15:53:53.337

Arithmetical results are always widened to at least 32-bit integers, which is why the two character values add up and print as "2014". A single character retains its type and should be printed verbatim. – mleise – 2016-08-03T21:25:37.717

1Couldn't you improve this by ditching the import and just qualifiying the write call (e.g., void main(){std.stdio.write('ϯ'+'ϯ');}) – Travis – 2014-01-10T02:14:15.833

No, the compiler still requires the import. – mleise – 2014-05-06T00:17:00.550


JavaScript 59, 44, 36, 29

a=+'';b=''+a+++a++;a+++b+ ++a

Assuming alert can be skipped due to implicit return

a=+'';b=''+a+++a++;alert(a+++b+ ++a)


Those are l characters not 1


Posted 2014-01-01T04:57:34.797

Reputation: 2 250

this is nice. +1 – gion_13 – 2014-01-05T17:28:51.637


J - 11 bytes - Base arithmetic



_bf and _bj are 15 and 19 in infinite base, therefore p:_bf is 15th prime, which is 53. The result is then 19*53 doubled, which is 2014.

J - 31 28 bytes - Math



The implementaion of A004126 sequence from OEIS where I searched for the ways to calculate 2014. Basically it's C(2*n+1,3)-C(n+1,3) where n=12.

This means ceiling(exp(signum(infinity))), which is 3


To get 12 we double it two times.


Everything else is a combo of a dyadic fork and monadic hook. You can read about them here.

Other's solution in J

+/(>.^*_)&u:'Happy new year to you!'

Which normally is +/3&u:'Happy new year to you!', it's a shame we need a number to work with strings.

It was fun to remember J :).


Posted 2014-01-01T04:57:34.797

Reputation: 6 838

2Another 11 char J solution: *./a.I.'&amp;j'. – randomra – 2014-12-27T21:28:35.293

it's a shame we need a number to work with strings. You don't. You could do +/a.i.'Happy new year to you!' – ɐɔıʇǝɥʇuʎs – 2014-07-19T14:58:22.470


AutoHotkey 31/13

send % ++(z:=true) z-z true z+z

This year special solution

send % A_year


Posted 2014-01-01T04:57:34.797

Reputation: 261

27 bytes: a:=Asc("")Asc(""), Send %a%. The characters in the Asc functions don't show correctly SE for me but they're the ASCII characters 20 and 14 copied and pasted into AHK. They show up as DC4 and SO (or maybe S0) in SciTE. – Engineer Toast – 2017-02-24T18:53:35.917


Golfscript - 11 10 chars


computes 38 * 53 (ie an expansion of the prime factorization of 2014: 2 * 19 * 53)

Old Version


This computes 462-102.

'f.'{}/ puts the ascii values of f and . on the stack.
.*      squares the value of the .
\-      swaps the two values, then subtracts


Posted 2014-01-01T04:57:34.797

Reputation: 17 266

Interestingly, the Befunge version of this Golfscript ('&amp;~I'{}/-*), "&amp;~I"-*.@, is one char longer than my Befunge answer and one character shorter than Golfscript. – Justin – 2014-01-01T10:33:03.587

1Note that 2*9=18; what you meant was 2*19=38. – Kyle Kanos – 2014-01-01T18:23:07.727


GolfScript, 10

I can't beat Quincunx's 10-char plain ascii solution but I can match it:


(it calculates 44*44+78)

And now a different approach :)

'codegolfing is yummy'{+}*


Posted 2014-01-01T04:57:34.797

Reputation: 20 689

5Yet another 10-char solution: "xr"{`(;}% (free bonus smiley included!) – Ilmari Karonen – 2014-01-01T14:58:01.903


Perl 6, 37 characters

This is not my actual solution (the real solution is in PHP, and is shorter), but I decided to make shorter version of Python's solution, because it's a really interesting idea.

say [+] ords 'Happy new year to you!'

So, what does it do? Well, it gets list of character positions (ords function), sums them together ([] is a reduce operator, which takes the exact operator between square brackets, in this case +), and say prints the result with new line. Could be WAY shorter by abusing ~^ prefix operator (which isn't implemented in Rakudo Perl) or Unicode characters, but this is just for fun solution.

Perl 6 is a quite an interesting language, even if it's not as good as Perl 5 in most code golf tasks (because of mandatory whitespace in many situations, and generally less DWIM). However, in this case, because of builtin sum and ords, it wins with Perl 5.


Posted 2014-01-01T04:57:34.797

Reputation: 9 392

say ord "ߞ" is shorter but certainly less whimsical. – Brad Gilbert b2gills – 2015-01-13T17:02:14.193

At first I thought you meant your solution was in Perl and was 6 characters long. And then I was like, "no, that can't be right." – Joe Z. – 2014-01-07T02:03:36.617


R using roman numbers, 29 characters



Posted 2014-01-01T04:57:34.797

Reputation: 2 190

1+1 I had no idea there was such a function! Nice find! – plannapus – 2014-01-14T15:29:51.047

@plannapus yeah I know crazy idea :) Well, but quite normal in ancient times :) – Tomas – 2014-01-14T15:34:40.450

probably a "legacy" function :) – plannapus – 2014-01-14T15:35:38.857

4Nice! There are 28 characters in as.double(as.roman('MMXIV')). – djhurio – 2014-01-15T07:11:15.343


C#, 60 characters

class a{static void Main(){System.Console.Write(- -'ߞ');}}

Thanks to mleise for the original answer for D!

Note: space between hyphens is important


Posted 2014-01-01T04:57:34.797

Reputation: 431

1 is not allowed – Random – 2014-01-07T05:31:36.747

I came up with 'ϯ'+'ϯ' but I believe this is 1 char shorter. – Jodrell – 2014-01-07T11:23:53.123

2if an exit code is acceptable class a{static int Main(){return - -'ߞ';}} is just 42 chars. – Jodrell – 2014-01-07T12:04:05.167

7No need for "- -'ߞ'", could just do +'ߞ'. So: class a{static void Main(){System.Console.Write(+'ߞ');}} which is 56 bytes – David_001 – 2014-01-07T13:00:41.077

1If we want to get without using the ASCII characters this is simple, int i; i = " ".Length; Console.WriteLine(i + "" + ((i-i)) + "" + --i + "" + ++i*i); – Vara Prasad.M – 2014-01-08T06:33:32.717

System.Console.Write(DateTime.Now.Year) has the added advantage that it will solve similar future contests as well :) – Julia Hayward – 2014-01-08T11:31:44.393

@JuliaHayward But it will fail this contest next year... – Spook – 2014-01-08T11:46:44.803

1@JuliaHayward and it will also fail this contest this year... (Reread the OP). – BrainSlugs83 – 2014-01-13T03:43:07.353

1OK, tongue-in-cheek comment failed utterly – Julia Hayward – 2014-01-13T09:38:56.827

1VS 2010 crashes when I try this with a fresh new Console Application... – Otiel – 2014-01-13T10:27:22.830


Ruby — 8 characters

p ?ߞ.ord

where ߞ is Unicode character U+07DE — N'Ko letter ka.

This is what it looks like when I copy and paste the above line and run it in my Terminal. Notice the character does not display:

enter image description here


Posted 2014-01-01T04:57:34.797

Reputation: 749

I understand what you're trying to do, but help me out... How do I test this? Copy & pasting your code doesn't work. If I copy & paste the little "07DE" Unicode char then I actually see \U+FFDF in irb, but that char has an ord of 85. – Darren Stone – 2014-01-01T20:30:59.693

I tested it by copying the symbol from the site listed above and running it in pry. I don't think Stack Exchange recognizes the symbol by default (so simple copy & paste of the above won't work), but Ruby 2.0+ should. – O-I – 2014-01-01T21:54:48.453

2This script prints nothing. – tobyink – 2014-01-02T15:36:31.407

1How did you enter it? It works for me. Also, what version of Ruby are you using? – O-I – 2014-01-02T16:16:34.280

Interesting. The N'Ko alphabet reads right to left. Interspersing it with Roman characters seems to shuffle characters depending on where you edit/paste. Has anyone else been able to get this to run, or am I the only one? – O-I – 2014-01-02T16:29:06.863

1p ?ߞ.ord would meet the requirement of printing. – steenslag – 2014-01-03T18:55:07.260

1this works for me – mpapis – 2014-01-03T20:04:04.470

@steenslag I must have been snoozing to miss the print requirement. I thought returning 2014 was sufficient. Corrected. Thanks for pointing that out! – O-I – 2014-01-03T20:39:52.670


Perl 6, 11 characters:

say 'ߞ'.ord


Posted 2014-01-01T04:57:34.797

Reputation: 161



alert(+!![]+!![]+[+[]]+ +!![]+(+!![]+!![]+!![]+!![]));

each +!![] is 1 (![] is false, !false is true and +true is 1)

+[] is 0, and [0] is "0"

so this turns into 1+1+"0"+1+(1+1+1+1)


Posted 2014-01-01T04:57:34.797

Reputation: 1 465


guess this is already beaten but I like the approach:

echo $two.$zero.$one.$four;

Thorsten Staerk

Posted 2014-01-01T04:57:34.797

Reputation: 211


Vim 7.4, 18 bytes

:h os_v<CR>$bbbyiwZZp

Here, <CR> means a literal newline. Uses the help page os_vms.txt which contains the number 2014 on the first line.

How it works:

:h os_v<CR>            This opens the help page for os_vms.txt, the line the cursor lands on contains '2014'.
           $bbb        Move the cursor to the '2014' (end-back-back-back)
               yiw     Copy it (yank-in-word)
                  ZZ   Close the help page
                    p  Paste the copied word

If numbers were allowed we could do:



Posted 2014-01-01T04:57:34.797

Reputation: 5 992

It's 2010 for me instead – Cows quack – 2016-12-18T13:17:28.157

@KritixiLithos Weird, it works for me. What help page does :h os_v open for you? – Loovjo – 2016-12-18T13:18:34.357

1It opens os_vms.txt says Vim version 7.3 and last change was made in 2010 Jul 8 – Cows quack – 2016-12-18T13:24:48.117

What version of Vim are you using? – Loovjo – 2016-12-18T13:26:23.177

I'm using Vim version 7.3 – Cows quack – 2016-12-18T13:44:48.127

Perhaps it is the difference in OS (I'm using macOS El Capitan) – Cows quack – 2016-12-18T13:50:52.960

@KritixiLithos I'm using 7.4 (also Capitan), that's probably why. I'll update the answer accordingly. – Loovjo – 2016-12-18T13:51:16.240

2If numbers were allowed you could just do i2014. :P – Joe Z. – 2016-12-18T21:01:26.090

@JoeZ. Oh right. I'm stupid :P – Loovjo – 2016-12-18T21:02:16.727


Python 3 (17 bytes)


Python 2 (50 bytes)

s,t=str,True;print s(t+t)+s(t-t)+s(t/t)+s(-~t<<t)


Posted 2014-01-01T04:57:34.797

Reputation: 151

1Those are actually 16 and 49 bytes respectively. The trailing newline doesn't count. – nyuszika7h – 2015-03-15T20:04:24.513

Python 2 version can be shortened to t=True;print't+t'+'t-t'+'t/t'+'-~t&lt;&lt;t', where the ' have to be changed to backticks. (I don't know how the enter real backticks that are shown as such). – WolframH – 2014-01-15T00:18:44.607

1@WolframH wrap the code-block in an extra backtick. Like so: t=True;print`t+t`+`t-t`+`t/t`+`-~t&lt;&lt;t` where the initialization and end of the code block are done by use of: \`. Alternatively, replace every`in the code with\: `t=True;print\`t+t\`+\`t-t\`+\`t/t\`+\`-~t&lt;&lt;t\ – Justin – 2014-03-05T06:06:52.980


Javascript (29 chars)


Not the shortest but some boolean logic

Rob Fox

Posted 2014-01-01T04:57:34.797

Reputation: 201

That was my first idea too haha. This is the best I could get: a=!'';a+a+""+(+!a)+(+a)+(a+a+a+a) (33 chars) – Benno – 2014-01-11T12:44:05.063

@Benno (+!a) is pretty clever, didn't know it works like this – Rob Fox – 2014-01-11T16:37:56.620

Yeah, it seems to treat it as an integer, only when in brackets though! Without the brackets, it reverts to 2falsetruetruetruetruetrue ;) – Benno – 2014-01-13T05:56:28.977


Javascript, 37 bytes


It's not code golf until someone bitshifts.

$ node
> ((_=+!![])<<''+_+''+_)-(_<<_+++_+_)-_

It is actually Javascript, I promise.

((_=+!![])    // create 1 and save in _
  <<          // left bitshift by 11 to get 2048
    ''+_+''+_ // create 11 from '1' + '1'
  -           // subtract (2048 - 32) === 2016
    _<<       // bitshift by 5 to get 32
  _+++_+_     // create 5 from 1 + (++1) + 2
)-_           // subtract 2 to get 2014

Dan Prince

Posted 2014-01-01T04:57:34.797

Reputation: 1 132

2That looks so much like Brainfuck. – Joe Z. – 2014-10-19T14:59:13.530


Bash 28

echo $((`printf %d \':`#yG))

Similar to the Ruby and Python solutions, but uses base62, now without literal 6 and 2 (but pretty long...)! Using base58 as recommended by @DigitalTrauma along with removing quotes around the printf format string, Thanks!

Better 17 (Thanks @user13955 and @DigitalTrauma!)

tr a-l /-:<<<dbcf

"It's shorthand for tr abcdefghijkl /0123456789:. Not very geeky, I'm afraid." -user13955 Also updated to use a heredoc instead of echo, thanks @DigitalTrauma!

Dom Hastings

Posted 2014-01-01T04:57:34.797

Reputation: 12 968

3Not a valid solution since 2 and 6 are forbidden. – Jubobs – 2014-01-01T12:32:28.110

haha, Oh dear... – Dom Hastings – 2014-01-01T12:41:26.390

1user13955 suggested this edit, might be worth considering: echo dbcf|tr a-l /-: It's shorthand for tr abcdefghijkl /0123456789:. Not very geeky, I'm afraid. – Justin – 2014-01-07T08:18:14.620

I have a solution in pure bash/ksh. i.e. it does not use any external program like tr. However, I lack the 10 reputation to post this. ;-) – Henk Langeveld – 2014-01-08T02:10:11.397

1Pure bash|ksh 110 bytes: sum(){ (IFS=+;echo $(($*)));}&amp;&amp;d(){ echo $((n=n+n));}&amp;&amp;false||n=$?&amp;&amp;sum $(d;d;d;d;echo $((n=n+n+n+n));d;d;d;d) – Henk Langeveld – 2014-01-08T02:38:36.727

1I verified that the unicode solution works in ksh93. – Henk Langeveld – 2014-01-08T02:46:37.000

As the question doesn't seem to preempt showing any other characters in addition to 2014, how about 'date' for 4 characters? HNY – David DelMonte – 2014-01-08T23:55:28.220

@DavidDelMonte, I think that answer has been suggested a few times, but it has to be 2014 specifically, otherwise, you'd be on to a winner! – Dom Hastings – 2014-01-09T06:19:28.687

1Use a bash here-string to shave 3 chars of the tr solution: tr a-l /-:&lt;&lt;&lt;dbcf – Digital Trauma – 2014-02-01T02:30:04.147

1And no need for the quotes around printf format string: echo $((\printf %d "'>"`#wu))` – Digital Trauma – 2014-02-01T02:34:16.463

1And use base 58 and drop one more char: echo $((\printf %d \':`#yG))` – Digital Trauma – 2014-02-01T05:06:50.293

@DigitalTrauma Amazing! Updated, thank you! – Dom Hastings – 2014-02-01T08:26:48.637

2@DigitalTrauma Pure bash 18: echo $[$[$#xd]#bbc] ... without fork! – F. Hauri – 2014-04-16T22:23:49.347

@F.Hauri Good one! – Digital Trauma – 2014-04-16T22:27:10.107


C, 37 Characters



Posted 2014-01-01T04:57:34.797

Reputation: 41

You could knock off 3 bytes by renaming main to f since we don't require main to be used. – MD XF – 2017-05-12T19:51:18.847


Javascript: 47 characters

Not the shortest, but another solution:

$ node
> [!+[]+!+[]]+[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]]


Javascript: 6 characters

Your task is to make a program that prints the number 2014 without using any of the characters 0123456789

Ok, here you go: 6 characters.

$ node
> "²⁰¹⁴"

Yeah, only for ASCII lowers. :-)

Will I win? :-D

Ionică Bizău

Posted 2014-01-01T04:57:34.797

Reputation: 186



p eval("#{""=~//}x#{"\a".ord}de")

Here is how it works inside IRB shell:

>> p eval("#{""=~//}x#{"\a".ord}de")


Posted 2014-01-01T04:57:34.797

Reputation: 141


TI-Basic, 49 41 31



  • π/π+π/π→B Store 2 in B
  • :B^B^B→C Store 16 in C
  • :C^C(C/B)-CB-B Display 2014


Posted 2014-01-01T04:57:34.797

Reputation: 11 060

I'm up voting on the assumption this works; I have no way to test it. – Michael Stern – 2014-01-03T12:59:03.667

@MichaelStern Explanation added :) – Timtech – 2014-01-03T15:22:56.807

:π/π+π/π→B:B^B^B→C:Disp C^C*(C/B)-C*B-B would be 2 characters shorter. – Michael Madsen – 2014-01-08T11:02:35.380

@MichaelMadsen Thanks, updated! – Timtech – 2014-01-08T11:49:22.263

8 bytes can be saved with various tweaks: iPart(e→B:BBBB:Ans^B(Ans/B)-AnsB-B – Scrooble – 2017-11-18T20:12:00.367

Another 23-byter: iPart(e→B:BBBB^(BBB)-BBBBB-B – Scrooble – 2017-11-18T20:17:50.730

That can be 21 without assignment to B, using Ans instead. I would advise at least fixing your current solution, as it currently outputs a number well over 2014. That should be C^B instead of C^C. – Scrooble – 2017-11-19T17:13:20.850


PHP: 54 chars

Slightly different approach, albeit long, using concatenation, and not using ordinal values:



Posted 2014-01-01T04:57:34.797

Reputation: 253

<?= echo date('Y') ?> – Surabhil Sergy – 2014-01-07T11:37:18.527

1@SurabhilSergy that is not a valid answer, the output will change in 2015. – zamnuts – 2014-01-07T22:44:28.323


J (18)

This one doesn't use any character codes. Uses the idea that the sum of the sequence of natural numbers from 1 -> 63 = 2016.



Posted 2014-01-01T04:57:34.797

Reputation: 71

You could save two bytes &lt;:&lt;:+/i.*:+~dyad – FrownyFrog – 2017-11-18T16:50:13.423


Multiboot x86 Assembly (250 bytes):

%define L(x) mov dword [eax],'zaza'-x
O equ 'A'<<`\xe`
F equ 'bab'-'aaa'
M equ `\xFF\xAF\xAA\xFA`-`\xFD\xFF\xFC\xDE`
C equ -(M+F)
dd M
dd F
dd C
dd h+O
dd h+O
dq 'a'-'a'
dd s+O
mov eax,'\'<<`\r`
add eax,'e'-'a'

Compile with:

nasm src.S -o 2014.bin -f bin -DN=32

(If someone has a suggestion for replacing the N macro, I'm all ears)


Posted 2014-01-01T04:57:34.797

Reputation: 1 087

1You can also submit the machine code as its own answer, provided final compiled binary doesn't have any bytes from 0x30 to 0x39 in it. – Joe Z. – 2014-01-07T02:48:44.820


PHP - 13 bytes


A fairly trivial ASCII-only solution.

Other variants:




Posted 2014-01-01T04:57:34.797

Reputation: 28 050

BEAU^pupa LOL. – Joe Z. – 2014-01-09T18:59:18.343

&lt;?=date('Y'); in any year ) – Dmitry Dubovitsky – 2014-01-13T14:50:39.260

@DmitryDubovitsky &lt;?=date(Y); would also work, but it won't always print 2014, as the problem requires. – primo – 2014-01-13T23:32:33.747


Golfscript, 6 chars


Inspired from Peter Taylor's answer.

This solution involves non-printable characters too.

Where x and y represent 20 and 14 in ASCII (the non-printable characters we were talking about before).


Posted 2014-01-01T04:57:34.797

Reputation: 2 793


T-SQL, 50 40

My original entry seems too straightforward. How's this?


(Disclaimer: Given Steve Matthews's comment, the above may be dependent on configuration.)

Here's the SELECT version in SQL Server 2012.

Original entry:
This may look obscene in more ways than one, but it's valid.

DECLARE @ INT=\PRINT CONCAT(-~-~@,@,-~@,-~-~-~-~@)

Try it in SQL Server 2012. Here is a version using SELECT.

Explanation: "\" is a valid currency symbol. (Do a find for "String to" here.) If you assign just a currency symbol to an INT variable, you store 0. Also, "@" is a valid variable name. "~" is bitwise NOT, and "-" is negative. If you negate a NOT-ed INT, you get the INT plus 1. So, repeat "-~" until you make @ into the digit you need. Then CONCAT() your digits.


Posted 2014-01-01T04:57:34.797

Reputation: 419

Running PRINT RIGHT(CHECKSUM(',,.'),LEN('````')) on MS SQL Server 2008 R2 produces the response "1200" – Steve Matthews – 2015-12-01T10:15:47.557

Can I suggest instead something like PRINT ASCII('')*ASCII('j') which is just 27 bytes (note that the character that isn't rendered here is the DC3 CHAR(19) in the first set of quote marks. – Steve Matthews – 2015-12-01T10:34:52.533

@Steve I actually ran the checksum one on the same version, too, but you touch on a good point that maybe the checksum algorithm could vary based on configuration. I should add a disclaimer. Also, I like your better 27-byte solution. You should post it as an answer so people can vote it up. – Muqo – 2015-12-01T18:59:22.267


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)


or 13 bytes with


But that idea has already been used by primo


Posted 2014-01-01T04:57:34.797

Reputation: 11 644


TI-BASIC, 12 bytes

A completely new approach.


This could probably be golfed further, using a 1-byte token in place of e, but I have spent far too long on this today...


Posted 2014-01-01T04:57:34.797

Reputation: 535


LiveScript, 18 bytes

The temporary solution

new Date!.getYear!


\ߞ .charCodeAt!

Over Excitement

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

Happy New Year!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


Posted 2014-01-01T04:57:34.797

Reputation: 827

3I initially assumed that you mean LiveScript, as in, JavaScript in first Netscape 2 beta. – xfix – 2014-01-02T13:51:11.083

1@GlitchMr, that's where the name came from :-) – FakeRainBrigand – 2014-01-02T20:06:55.153


Fortran: (43 27)


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).

Original answer:


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

Kyle Kanos

Posted 2014-01-01T04:57:34.797

Reputation: 4 020

Shorter version using hexadecimal literals: print*,z'FBC'/len('hi');end. – Hristo Iliev – 2014-01-08T12:31:53.937

@HristoIliev: Totally forgot about printing hex via z! Thanks a bunch! – Kyle Kanos – 2014-01-08T14:51:19.940


MATLAB (no char codes), 47 chars


Christopher Creutzig

Posted 2014-01-01T04:57:34.797

Reputation: 348

I played with a similar approach in Mathematica (which has a much larger set of mathematical constants built-in). How long did it take you to develop that solution. – Michael Stern – 2014-01-02T22:46:59.363

Just playing around, maybe five minutes, probably less. I’m pretty sure this is far from the most compact formula. – Christopher Creutzig – 2014-01-03T13:13:01.737


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

Cybermaxs - Betclic

Posted 2014-01-01T04:57:34.797

Reputation: 131

1Even though it's the longest answer rather than the shortest, +1 for JSFuck. – Joe Z. – 2014-01-01T21:04:05.993


Python 2, 68 bytes

Not really short, but it abuses the fact that Python accepts booleans where an integer is required, because bool is a subclass of int.

import string;d=string.digits;T=True;print d[T+T]+d[:T+T]+d[T+T+T+T]


Posted 2014-01-01T04:57:34.797

Reputation: 1 561

+1 for the first non-cheating program in this question that doesn't depend on ASCII or UTF-8 (unless I missed something) – xfix – 2014-01-01T21:54:41.903

False can be shortened to d&gt;d. On the other hand, d[d&gt;d]+d[T] can be shortened to d[:T+T], so that optimization is not really necessary ;-). Also, from string import*;d=digits;saves one character. – WolframH – 2014-01-15T00:12:41.163

@WolframH Noted. I'll update it later. – nyuszika7h – 2014-01-21T21:49:29.547


bash 35

I want something that doesn't use ASCII or UNICODE.

[ ];x=$?;y=$[x+x];echo $y$?$x$[y+y]

If you don't mind some error messages mixed in (28 characters):

[;x=$?;echo $x$?$[x/x]$[x+x]

You can get rid of the error messages if you don't mind corrupting a file (32 characters):

[ 2>x;x=$?;echo $x$?$[x/x]$[x+x]

Stephen Montgomery-Smith

Posted 2014-01-01T04:57:34.797

Reputation: 231

1That doesn't use ASCII? That's a bit hard. – Joe Z. – 2014-01-07T02:04:40.073

@JoeZ. My program would work just as well if the system used ebcdic. And as you know, a multitude of ebcdic systems use bash. :-) – Stephen Montgomery-Smith – 2014-01-07T03:20:57.527


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).


Posted 2014-01-01T04:57:34.797

Reputation: 111

The exact same code works for VB6 too. – Rob – 2014-01-04T00:06:26.347

user14566 suggested this edit: `27 bytes: MsgBox(Asc("") & Asc(""))

=20 =14` – Justin – 2014-01-13T07:05:42.283

2You can run this in the immediate window of VBA as ?Asc("j")*vbKeyPause, which shortens it up a bit. – Gaffi – 2014-03-05T16:46:10.420


newLISP - 61 characters

I can't seem to play golf in Lisp -- is it just too wordy?

(int(apply string(map(fn(c)(find c'(b c a e d)))'(a b c d))))


Posted 2014-01-01T04:57:34.797

Reputation: 569


C# - 64 chars

class P{static void Main(){System.Console.Write('!'*'>'-' ');}}

pretty printed

class P 
    static void Main() 
        System.Console.Write('!' * '>' - ' ');


Posted 2014-01-01T04:57:34.797

Reputation: 681

What if we use class P { static void Main() { System.Console.Write(2014); } } – Amit Ranjan – 2014-01-07T06:55:16.800

@Amit, you can't use numbers in this challenge... – shamp00 – 2014-01-07T09:10:44.703

2if an exit code is acceptable class a{static int Main(){return '!'*'&gt;'-' ';}} is just 47 chars. – Jodrell – 2014-01-07T12:05:54.847

1I like this one, my countdown numbers skills sucked so I ended up with ('d' + 'e').ToString() + Math.Ceiling(Math.PI); – SLC – 2014-01-08T15:02:19.160


Clojure, 9 bytes

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

(int \ߞ)


Posted 2014-01-01T04:57:34.797

Reputation: 153


Haskell, 69 bytes

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:

instance Monad ((->) r) where
        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:

import Control.Monad.Instances


Posted 2014-01-01T04:57:34.797

Reputation: 81


Sclipting, 3 characters (6 bytes)

This outputs the string "2014".



Posted 2014-01-01T04:57:34.797

Reputation: 11 577

That's not 3 bytes though. – daniero – 2014-01-23T19:52:52.037

I didn’t say it was. – Timwi – 2014-01-23T20:02:06.143

Well I can see that obviously, but the question actually asks for a byte count. – daniero – 2014-01-23T20:30:30.677

Byte count stands at 12, I believe. – cjfaure – 2014-02-08T19:34:54.163

1No, it’s 6 bytes. – Timwi – 2014-02-08T20:35:59.150


Pure bash 18

Without fork!

echo $[$[$#xd]#bbc]

F. Hauri

Posted 2014-01-01T04:57:34.797

Reputation: 2 111


Pyth, 4 bytes


Pretty straightforwards, just convert that character to an integer and print.


Posted 2014-01-01T04:57:34.797

Reputation: 33 634

While this answer is now technically the shortest, I can't accept it because it was written in a language that didn't exist at the time of writing the question. – Joe Z. – 2014-07-08T11:08:44.847

@JoeZ. I understand. No worries, the rules make sense. – isaacg – 2014-07-08T15:50:17.623


Windows Calculator - 5 characters

Inspired by this answer to a different question.

Open the Windows Calculator in Programmer View (Hex mode) and type:


This is what the result looks like.

enter image description here

me and my cat

Posted 2014-01-01T04:57:34.797

Reputation: 792

5If you change the size to Word, it will be an almost-valid answer that will output only 2014 – Ismael Miguel – 2015-01-09T11:49:10.283

I don't think this is a programming language... – cat – 2016-04-07T14:40:20.807


Racket, 18 bytes

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

Matthew Butterick

Posted 2014-01-01T04:57:34.797

Reputation: 386


Excel VBA, 51 bytes

MsgBox Len("aa") & Len("") & Len("a") & Len("four")

As it's 2015 you could add an extra character onto "four" for an extra byte.


Posted 2014-01-01T04:57:34.797

Reputation: 321


Japt, 3 bytes (2 chars)

Japt is newer than this competition (created in 2015), but was not created specifically to answer it.

That's right. 2 chars. Explanation:

#   // Char-code of next character
 ߞ  // Character with char-code of 2014
    // Implicit output

Try it online!


Posted 2014-01-01T04:57:34.797

Reputation: 42 391

Does this mean I can undelete my Microscript answer? – SuperJedi224 – 2015-12-09T02:25:14.237

@SuperJedi224 There's a list in the main post of "invalid but interesting answers". I think newer languages fall into this category. – ETHproductions – 2015-12-09T02:31:50.690


Java 8, 33 bytes


Shaun Wild

Posted 2014-01-01T04:57:34.797

Reputation: 1 442


Jelly, 3 bytes


Try it online!

Erik the Outgolfer

Posted 2014-01-01T04:57:34.797

Reputation: 25 165


Emotinomicon, 4 UTF-8 chars (14 bytes)



  ߞ       explanation
              begin quote string
              end quote string
              pop N and output as a number

ߞ is U+7DE. 0x7DE is 2014.

Erik the Outgolfer

Posted 2014-01-01T04:57:34.797

Reputation: 25 165


The Shakespeare Programming Language, 219 bytes

I am using drsam94's compiler.

Act I:
Scene I:
[Enter Ajax and Puck]
You is the difference between a fat fat fat fat fat fat fat fat fat fat fat cat and the sum of a fat fat fat fat fat cat and a fat cat!Open thy heart!



Everything from the first line to the first period is the title, parsed as a comment.


These are characters from Shakespeare's plays, and descriptions (also comments)

Act I:
Scene I:

Act I and Scene I, used for gotos (not used here)


The character speaking.

You is the difference between

Assigns the difference of the next two values to the character being spoken to.

a fat fat fat fat fat fat fat fat fat fat fat cat

Every adjective multiplies by 2, a noun is either 1 or -1 depending on its connotation (in this case it's 1). 2^11 * 1 = 2048.

the sum of a fat fat fat fat fat cat and a fat cat

The sum of the next two values. 32 + 2 = 34, so 2048 - 34 = 2014

Open thy heart!

Prints the value of the character being spoken to as a number.

Oliver Ni

Posted 2014-01-01T04:57:34.797

Reputation: 6 425


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


Posted 2014-01-01T04:57:34.797

Reputation: 37 405


Using the integer metagolfer in WheatWizard's brain-flak optimizer I found ((((((()()()()()){}){})){}{}()){()()({}[()])}{}()) which is 4 bytes shorter.

– 0 ' – 2016-12-15T07:30:55.973

The challenge requires languages in which 0123456789 are valid tokens. Does Brain-Flak satisfy this requirement? – Dennis – 2017-01-07T17:17:15.563


EXCEL: 148 bytes


only works in A1.


Posted 2014-01-01T04:57:34.797

Reputation: 2 140


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.

Wheat Wizard

Posted 2014-01-01T04:57:34.797

Reputation: 33 549

The challenge requires languages in which 0123456789 are valid tokens. Does Brain-Flak satisfy this requirement? – Dennis – 2017-01-07T17:17:03.453

2@Dennis yes @lt flags use decimal literals – Wheat Wizard – 2017-01-07T21:59:15.817


JavaScript, various solutions: 131, 44, 43, 30, 28, and 16 characters (16 bytes)

Original answer:

JS-fuck inspired JavaScript, 131 characters:


Shifty truth edition:



Edit: I'm having too much fun with this... combining type coercion with hex strings, 44 characters.


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:


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:


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'
// +'0o3736'


Posted 2014-01-01T04:57:34.797

Reputation: 121

2Welcome to the site, and nice first post! – Scrooble – 2018-03-08T20:55:48.233

Thanks. Do you know of any ways to show all answers on one page so I can quickly check for duplicates next time? ;) – Job – 2018-03-08T20:57:31.693

1@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 – 2018-03-08T21:11:30.487


@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.

– Scrooble – 2018-03-08T21:23:33.640

1Thanks for the tips! Added some more solutions :) – Job – 2018-03-09T00:28:49.897


C++, 50 bytes

int main(){std::cout<<'U'^'A';}

zeeshan mughal

Posted 2014-01-01T04:57:34.797

Reputation: 131

You should provide compile-ready code in C++. – Joe Z. – 2014-01-01T05:24:31.243

Also, use four spaces before each line for blocks of code. – Joe Z. – 2014-01-01T05:29:30.457

i added "iostrean but it disappeared, actually am new so don't know how to" – zeeshan mughal – 2014-01-01T05:29:48.790

5This is supposed to be code golf, i.e. shortest code possible. Remove unnecessary whitespace, etc – Doorknob – 2014-01-01T05:32:47.690

@DoorknobofSnow thanx, after your edition i can still see few extra spaces – zeeshan mughal – 2014-01-01T05:34:53.547

Rather verbose. int('U'-'A') prints 20, int('O'-'A') 14. Even shorter: ~~'U'-'A' also is 20. Result: #include &lt;iostream&gt; int main(){std::cout&lt;&lt;~~'U'-'A'&lt;&lt;~~'O'-'A';}. – MSalters – 2014-01-02T15:13:43.213

Even more shorter: 'U'^'A'. – MSalters – 2014-01-02T15:18:51.140

@MSalters Did you try compiling this? g++ on all standard versions gives an error: no match for ‘operator^’. – LegionMammal978 – 2017-08-11T02:03:40.800

Doesn't work! – NieDzejkob – 2017-12-17T17:16:50.873


PHP (21 chars)

<?=ord('').ord(''); //These are not empty strings ;)

If you don't believe it, see the proof.


Posted 2014-01-01T04:57:34.797

Reputation: 361

If it contains non-printables, you should provide a hex dump or list them. – mbomb007 – 2016-03-04T20:06:31.940

That looks like 19 characters to me. – Joe Z. – 2014-01-02T15:06:50.087

1(Oh wait, nonprintables.) – Joe Z. – 2014-01-02T15:07:17.337


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.


Bob Jarvis

Posted 2014-01-01T04:57:34.797

Reputation: 429

Do you need all that whitespace? – cat – 2016-04-18T02:38:18.210

I suppose that you don't need to convert back to integer, instead add an output function. – Paŭlo Ebermann – 2014-01-05T18:15:34.983


Python 51

Using true = 1 and false = 0

print str(t+t)+str(t-t)+str(+t)+str(t+t+t+t)


Posted 2014-01-01T04:57:34.797

Reputation: 141

clever. 40 chars in PHP: $t=true;echo $t+$t.$t-$t.$t.$t+$t+$t+$t; – zamnuts – 2014-01-05T10:08:56.750

Damn just wrote that while reading the answers well done, – Noelkd – 2014-01-05T10:37:55.350


C, 31 bytes -- without a multi-character literal



Posted 2014-01-01T04:57:34.797

Reputation: 581

Save 3 bytes by shortening main to f, since we don't require main to be used. – MD XF – 2017-05-12T19:52:12.727


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:



Posted 2014-01-01T04:57:34.797

Reputation: 71


Julia, 13 characters


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'

Edit: 11 characters, thanks to Glen O

A different choice of characters allows us to skip parentheses:



Posted 2014-01-01T04:57:34.797

Reputation: 8 020

Just thought I'd point out that a different sequence can save you a few characters. For instance, '.'*'.'-'f' is only 11 characters. – Glen O – 2014-06-06T03:36:23.017

@GlenO thanks! I added it as an edit. – plannapus – 2014-06-06T07:15:46.683


x86 - 16 bytes (Assembled)

This little snippet moves the stack so it overlaps the video memory, to then push the individual numbers straight to the screen (They even blink! Surely a sign of good times to come).

Code: (Note: '0'-'9' -> 0x30-0x39)

B890A8 8ED0 2C5C 50 2C04 50 48 50 40 40 50

Assembled from:

mov ax, 0xA890
mov ss, ax
sub al, 0x5c
push ax
sub al, 3
push ax
dec ax
push ax
inc ax
inc ax
push ax

Build'n run:

nasm -f bin -o 2014.asm

Robert Sørlie

Posted 2014-01-01T04:57:34.797

Reputation: 1 036

@TeunPronk but that's the generation code, not the submission -- the submission is the binary – cat – 2016-04-15T23:47:22.047

1I think it shouldn't have any characters [0..9] in your code – Teun Pronk – 2014-01-31T14:56:26.113


~-~! (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.


Posted 2014-01-01T04:57:34.797

Reputation: 4 143


k [16 chars]



Get the ASCII value of ",.".

46 44

Find the product


Get the data type of char.


On running the complete code (2024-10)



Posted 2014-01-01T04:57:34.797

Reputation: 448

112 chars: +/&amp;" ~~~~h'"; 6 chars, 7 bytes, unicodey: \i$"ߞ"` – zgrep – 2017-04-13T13:00:35.033

1+1 for using k. – cjfaure – 2014-03-10T08:54:15.873


><> (9 bytes ASCII)

In pure ASCII,


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:


Simply outputs the numerical value of ߞ and ends.


Posted 2014-01-01T04:57:34.797

Reputation: 51

1You could shorten 'ߞ'n; to 'n;ߞ, I believe. – Addison Crump – 2015-11-01T12:03:30.323


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.


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


Posted 2014-01-01T04:57:34.797

Reputation: 4 355


awk (28)

There's definitely a need for an "awky" answer... ;-)


...oookaaayyy... the last * may be a + too. But please don't call it an "awkf*ck" solution then... ;-)


I think, I prefer the later version now because of less different characters...

(tested with gawk and mawk)


Posted 2014-01-01T04:57:34.797

Reputation: 2 278


Insomnia, 7

Each line is one program doing the same thing: print 2014 to output stream.



Posted 2014-01-01T04:57:34.797

Reputation: 5 161


JavaScript, 24 bytes

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



The character ߞ is obtained by doing String.fromCharCode(2014) . Thus the code is actually just converting that character back to its character code and alerting it.

Thanks to hsl for this shorter version


Posted 2014-01-01T04:57:34.797

Reputation: 23 401

That code doesn't work. Did you mean alert("ߞ".charCodeAt())? – NinjaBearMonkey – 2014-12-27T21:12:41.190

@hsl String.charCodeAt is present only in Firefox, it seems. But I'll use charCodeAt since its multi browser and shorter . Thanks! – Optimizer – 2014-12-27T21:25:49.687


Python 2 (19 bytes, ASCII only, CPython-specific)

print hash("w_'qe")

Tested only on 64-bit, but I assume/hope that since 2014 is small and positive the results would be the same on 32-bit? Originally tested on Python 3, but ProgramFOX confirms it also works on Python 2.

Python 3 (31 bytes, ASCII only)

print(ord("\N{NKO LETTER KA}"))

Quite fond of this one, even though better solutions exist. The equivalent Python 2 code is no shorter, as it required a u string prefix.

Uri Zarfaty

Posted 2014-01-01T04:57:34.797

Reputation: 1 802

1I tested on Python 2.7, and it works fine there; so you can save one character. – ProgramFOX – 2015-01-01T16:40:28.800

I found the same python 3 version, but shorter (16 bytes) as I didn’t restrict myself to ASCII :print(ord('ߞ')) – Frédéric Grosshans – 2015-11-04T14:37:06.237


Python (30 chars)

(10 + 9) * 106 = 2014



Posted 2014-01-01T04:57:34.797

Reputation: 211


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

Jacob Misirian

Posted 2014-01-01T04:57:34.797

Reputation: 632


Milky Way 1.0.0, 22 bytes



<          <     <   # 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



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

Zach Gates

Posted 2014-01-01T04:57:34.797

Reputation: 4 428


Jolf, 3 bytes

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

@  Get charcode of next character
 ߞ charcode 2014

Conor O'Brien

Posted 2014-01-01T04:57:34.797

Reputation: 25 859


C, 33 30 bytes

Numerical Solution 1


// 2014 = 60 * 35 - 86

C, 86 83 bytes

Numerical Solution 2

#define A ((int)'}')
#define B (((int)'r')-((int)'d'))

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

C, 53 50 bytes


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


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

C, 94 91 bytes


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


╔═╗ ╔═╗ ╗ ╦ ╦
  ║ ║ ║ ║ ║ ║
╔═╝ ║ ║ ║ ╚═╣
║   ║ ║ ║   ║
╚═╝ ╚═╝ ╩   ╩


Posted 2014-01-01T04:57:34.797

Reputation: 1 365

You could shorten all your mains to f, saving 3 bytes each, and your submission will still be valid. – MD XF – 2017-05-12T19:53:31.647


BASIC v2.0 (Commodore 64), 24 bytes

PRINT ASC("&")*(ASC("V")-ASC("!"))

The Commodore BASIC tokens are single-byte representations of BASIC keywords. This should result in storing the above line as 24 bytes instead of 34.

I was aiming to construct an equation based on character codes, so I was looking for ideal characters in PETSCII. To minimize the number of operations in the equation, it seemed like a good idea picking a pair of divisors of 2014.

However, none of the combinations were perfect, because either one of the divisors were too large, too small or the character code of a number.

So I ended up using 38 which is CHR$("&") and 53, but instead of directly using the latter which is CHR$("5"), I used the difference of 86 and 33. These are the character codes for CHR$("V") and CHR$("!") respectively.

Tested in VICE and FC64.


Posted 2014-01-01T04:57:34.797

Reputation: 61


JavaScript, 9 bytes


This Base-64 encodes ÛMx to make 2014.


Posted 2014-01-01T04:57:34.797

Reputation: 1 340


Lua, 32 bytes


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


Posted 2014-01-01T04:57:34.797

Reputation: 371


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.


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

Try it online!

Beta Decay

Posted 2014-01-01T04:57:34.797

Reputation: 11 590


><> FISH 7 bytes


Fairly easy one in ><>, puts 14 then 20 on the stack and prints both (Fish is FILO based).

Teal pelican

Posted 2014-01-01T04:57:34.797

Reputation: 1 208


Vim 8.0, 15 bytes

:h u

I didn't see a vim answer yet, so I figured I'd add one. This opens up a helpfile, so it is specifically vim 8.0, since it might not work with a future version that updates that file.


Posted 2014-01-01T04:57:34.797

Reputation: 37 405

Clever! In my case :h followed by 9wywZZp works. So down to 10 symbols/bytes – defhlt – 2016-12-05T17:22:50.943

@defhlt OK, good to know! Although technically that doesn't work because it uses the digit 9. You could do f:w in place of 9w for only one byte more. Which version of vim do you have? – DJMcMayhem – 2016-12-05T17:25:04.843

Also, !!date +\%Y is 12 symbols (assuming you are reading this from 2014) – defhlt – 2016-12-05T17:26:02.593

You are totally right! I use nvim 0.1.6-dev. – defhlt – 2016-12-05T17:28:43.340


05AB1E, 6 bytes (non-competing)


Uses the CP-1252 encoding. Try it online!


T       # Push 10
 ·      # Multiply by 2
  žv    # Push 16
    Í   # Subtract 2
     «  # Concatenate
        # Implicit output

Oliver Ni

Posted 2014-01-01T04:57:34.797

Reputation: 6 425


JavaScript, 81 76 bytes

l="length";alert(("hi"[l]<<"javascript"[l])-"wow"[l]*"hello death"[l]-true);

Hristiyan Dodov

Posted 2014-01-01T04:57:34.797

Reputation: 176


C, 24

(Using GCC-4.9.2)

f(){printf("%i",'Þ');}         (Properly formatted version on Pastebin)

IMPORTANT NOTE: There is a U+0007 in-front of the Þ character but stackexchange removes it for some reason. Make sure you edit it back in before compiling my code. Here is a pastebin of the code that does include the unicode characters needed.

Albert Renshaw

Posted 2014-01-01T04:57:34.797

Reputation: 1 978


SmileBASIC, 10 bytes


&HFBC is hexadecimal for 2014*2, which is right shifted by not(0.0)

?ASC("ߞ") looks shorter, but it's actually the same length when saved in UTF-8, and about 100000x more boring.


Posted 2014-01-01T04:57:34.797

Reputation: 3 806


Sinclair ZX81 15 bytes 10 bytes


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

Shaun Bebbers

Posted 2014-01-01T04:57:34.797

Reputation: 1 059

1You've used a 1 in your answer. – caird coinheringaahing – 2017-04-02T01:09:40.143

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 – 2017-04-02T06:27:16.507

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 – 2017-04-02T06:30:08.930

Correction on my last comment: there not therem. – Shaun Bebbers – 2017-04-02T07:24:22.993


√ å ı ¥ ® Ï Ø ¿, 8 bytes


Try it online!

The rest of the code in the TIO link is the Python interpreter (because I can't be bothered to ask Dennis to add √ å ı ¥ ® Ï Ø ¿

caird coinheringaahing

Posted 2014-01-01T04:57:34.797

Reputation: 6 705


Braingolf, 3 bytes

Try it online!

The ordinal of ߞ is 2014, # pushes the ordinal of the next character to the stack, and Braingolf implicitly outputs the last item on the stack.


Posted 2014-01-01T04:57:34.797

Reputation: 4 938

Braingolf is your language, right? – MD XF – 2017-06-06T19:11:25.403

@MDXF Indeed it is – Mayube – 2017-06-06T19:46:55.463


Charcoal, 5 bytes


Try it online!

Language was created after January 1, 2014, but as Charcoal uses the superindices ⁰¹²³⁴⁵⁶⁷⁸⁹ to represent the numbers, the answer is valid. :-)


Posted 2014-01-01T04:57:34.797

Reputation: 5 531


Lean Mean Bean Machine, 53 bytes

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

I like this.


Posted 2014-01-01T04:57:34.797

Reputation: 4 938


Lua, 29 bytes

b=("").byte print(b"?"..b"?")

NB: the two question marks are substitutes for characters that are not appearing properly in the post. See the tio link below for proof.

Try it online!

As an interesting point, although this is not the case with Lua, a language with an implementation of pi to at least 3137 digits would be able to print pi and find '2014' at digits 3133-3136!


Posted 2014-01-01T04:57:34.797

Reputation: 93


J, 21 bytes


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


11 bytes



Posted 2014-01-01T04:57:34.797

Reputation: 1 161


Python, 41 bytes

print(int(ord("j")/len("aa") * ord("&")))

Try it online!


Posted 2014-01-01T04:57:34.797

Reputation: 11

2Welcome to the site! The aim of this question (and code golf in general) is to get the shortest functional code. You can remove the spaces around the * to start with. – caird coinheringaahing – 2018-01-07T20:51:51.207


><>, 7 bytes


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.


Posted 2014-01-01T04:57:34.797

Reputation: 471


LibreLogo (Paper Format: Tabloid), 55 bytes

The document must be in Tabloid Format for this method to work.


print ''.join(set(str(pagesize.pop()))).replace('.','')


enter image description here


pagesize                                           ; Returns [792.0, 1224.0] (Tabloid Format)
pagesize.pop()                                     ; Returns 1224.0
str(pagesize.pop())                                ; Returns "1224.0"
set(str(pagesize.pop()))                           ; Returns {u'2', u'0', u'1', u'.', u'4'}
''.join(set(str(pagesize.pop())))                  ; Returns "201.4"
''.join(set(str(pagesize.pop()))).replace('.','')  ; Returns "2014"

Grant Miller

Posted 2014-01-01T04:57:34.797

Reputation: 545


Canvas, 7 bytes


Try it online!

AA       | Push 10 to stack twice
   +      | Add top two items in stack
    q     | Print top item in stack on current line
      ⁷    | Push 16 to stack
       ┤   | Decrement top item in stack twice
        t | Print top item in stack on current line, disable implicit output


Posted 2014-01-01T04:57:34.797

Reputation: 471


R, 39 bytes:


R, also 39 bytes:


More entertaining version: 46 bytes


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)


Posted 2014-01-01T04:57:34.797

Reputation: 31


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


Posted 2014-01-01T04:57:34.797

Reputation: 305


Objective C

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy"]; 
NSLog(@"%@",[formatter stringFromDate:[NSDate date]]);

Milap Kundalia

Posted 2014-01-01T04:57:34.797

Reputation: 121

NSLog(@"%i",'&amp;'*('F'-'A')); – Albert Renshaw – 2017-02-16T18:57:18.297


From the comments: Gelatin: “Is it acceptable to use the current year?” Joe Z.: “No, it has to be 2014 exactly.”

– manatwork – 2014-01-01T13:17:34.027

Because the question is a code-golf question, please add the character count. – ProgramFOX – 2014-01-01T13:31:16.810

1What happened to you, Smalltalk ? You look...different. – bug – 2014-01-07T01:17:56.403


You never said we couldn't put it on an external page!

Javascript - 19 Chars


PS. It took 2 tries to get a shortened URL without numbers :P


Posted 2014-01-01T04:57:34.797

Reputation: 489

Yes, but sadly your code is far from being the shortest. :P – Joe Z. – 2014-01-01T18:26:18.263

1@Joe Z. Right, you could include an HTML script src instead :P – Cilan – 2014-01-01T23:10:12.560

location.href.match(/-(\d+)-/).pop() – Alf Eaton – 2014-01-03T09:18:57.627

location='' would be shorter in my opinion. – xfix – 2014-01-04T11:23:18.060

@xfix Thanks for the tip, I even removed 'http:' :) – Cilan – 2014-02-08T19:24:21.323

You can take out those two slashes at the start too. ;) – cjfaure – 2014-02-08T19:33:15.343

@Trimsty I wish, but unfortunately not ;( – Cilan – 2014-02-08T19:33:56.223

@TheWobbuffet Hm. That's really weird, I really thought it'd work! Sorry. – cjfaure – 2014-02-08T19:39:28.973


ANSI C - 95 47 52 characters

#include <stdio.h>
main() { printf("%i", (('a' + 'a')/'a') * ('\a' + '\f') * ('<' - '\a') ); }

This program uses characters to initialise integers and multiplies: 2 * 19 * 53.

#include main(){printf("%i",'\aÞ');}

This program initialises an integer using charaterbytes and prints it. '\aÞ' is the bitpattern 00000111 11011110 this is also the bitpattern of 2014.

Disclaimer: this was made on a windows system with visual studio. This code depends on a lot of things, including - How your compiler endodes the characters you input. Þ has an ascii value of 222 (or its negative equivalent), this may vary depending on your system. The notation int a = 'abcd'; is in itself evil and depends on how memory is handled on your system - this includes endian issues. int a = '\0A'; a is 65 on my system but may be 16640 on your system.


I went back to Version one and multiplied 2 * 19 * 53. This version uses only one byte at a time so it is endian compatible. Also it uses only characters in the range of [0 - 127] to be compatible to all systems.


Posted 2014-01-01T04:57:34.797

Reputation: 199

You don't actually need to include stdio.h, most compilers will give a warning but include it for you. – nyuszika7h – 2014-01-01T21:58:50.720

This code yields 7 for me with tcc and 508830 with gcc. clang gives an error: character too large for enclosing character literal type. – nyuszika7h – 2014-01-01T22:02:40.410

@nyuszika7h ... 7 is equivalent with \a - this could be a problem with passing to the printf function, it would be interesting for me to see if int a = '\aÞ' is 2014 using tcc. 508830 looks very strange to me - i would guess some endian thing but n * 256 + 7 can never be that number. So this illuminates how string this code depends on the system. – Johannes – 2014-01-01T22:58:20.533


Racket: 20 (19 chars)

(char->integer #\ߞ)

ߞ is a unicode character that has 2014 as it's code.

This abuses the fact that every top level form gets its evaluation printed to stdout. This is quite unique amongst LISPs which usualy only have this behaviour in the REPL and not when running programs.

Scheme: 29 bytes (28 chars)

(display(char->integer #\ߞ))


Posted 2014-01-01T04:57:34.797

Reputation: 3 458

So 29 bytes, then? – Joe Z. – 2014-01-01T18:47:54.733

1@JoeZ. Yes. I was just about to update it :) – Sylwester – 2014-01-01T18:49:15.593

At least in Racket, you don’t need to call display — the REPL will print the result of char-&gt;integer automatically — which would save you another 9 chars. – Matthew Butterick – 2014-10-19T17:19:16.387

@MatthewButterick Unlike Scheme and CL #!racket actually display every top level result to stdout even when running a compiled program. It's quite annoying but I can abuse that. thanks :) – Sylwester – 2014-10-19T18:20:24.210

Still beat it, I’m afraid – Matthew Butterick – 2014-10-19T20:39:53.373


maybe not the shortest, but one of the more readable ones in Smalltalk:

Transcript show: Date today year.

Joachim Tuchel

Posted 2014-01-01T04:57:34.797

Reputation: 131

This doesn't work.. (lol) – Albert Renshaw – 2017-01-30T03:36:38.997


see the comments. You can't use current Year.

– Wasi – 2014-01-01T19:27:44.493


Solution 1

Octave/Matlab (55 chars)


Solution 2

PHP (9 chars without tags, 12 with them Actually 2022 because of the new lines involved)

  2013 lines -->
<?=__LINE__; <!-- This should be on line 2014 -->


Posted 2014-01-01T04:57:34.797

Reputation: 2 793

That would be 2013 newlines followed by &lt;?=__LINE__ for 2024 chars, not 9. – Peter Taylor – 2014-01-02T09:28:01.420

@PeterTaylor I didn't write 9 chars to win the challenge (since there are lots of shortest answers!), but because the actual code is that &lt;?=__LINE__;?&gt;, which I thought would be funny :) Nvm, I'll edit that. – Vereos – 2014-01-02T09:31:52.200

If it doesn't work without the newlines, they're part of the "actual code". – Peter Taylor – 2014-01-02T09:32:21.890

I guess you're right, edited. – Vereos – 2014-01-02T09:37:10.877

1In PHP, you can skip ?&gt; at end of the program. But interesting idea with __LINE__, even if it's ridiculous for such huge number. – xfix – 2014-01-02T12:15:14.013


Game Maker Language, 22



Posted 2014-01-01T04:57:34.797

Reputation: 11 060


C - 44 characters (85 with headers)

What, no one is abusing strings yet?


Interestingly, this is a special case where neither character is printable, but their special code doesn't involve a number.

If we want no warnings, it needs to become 55 (96) characters:

int main(){return!printf("%u",ntohs(*(int*)"\a\xde"));}

Brendan Long

Posted 2014-01-01T04:57:34.797

Reputation: 111


Python, 14 characters

print ord('ߞ')

Short way ;)


Posted 2014-01-01T04:57:34.797

Reputation: 866

Does it work without the u before the string? – Joe Z. – 2014-01-07T02:16:27.130

TypeError: ord() expected a character, but string of length 2 found – boothby – 2014-01-07T05:41:04.490

1@JoeZ. this is valid Python 3 – Peter Gibson – 2014-01-07T06:21:59.677

1In Python 3: SyntaxError: invalid syntax (Python 3 needs brackets around stuff being printed). – Joe Z. – 2014-01-07T07:41:28.197


C/C++ 39


ASCII for: ':' = 58, '&' = 38, ',' = 44. Using that, 58-38 = 20 and 58-44 = 14.


Posted 2014-01-01T04:57:34.797

Reputation: 141


120 characters in Squeak Smalltalk trunk (4.5).
I did not search the shortest, but kind of graphical solution:

((Text string:'Happy\New year'withCRs attribute:TextEmphasis narrow)asMorph borderWidth:Float one+Float one)bounds area

It depends on font, margins, and so is quite fragile, but at least for me it worked.
In Squeak 4.4, it works with lowercase 'happy\new year'.


Posted 2014-01-01T04:57:34.797

Reputation: 391


JavaScript, 49 Chars

A mathematical JavaScript version making use of only PI and E as source numbers.


... mmmm PIE.

Oh and just in case implicit returns are vetoed (56 Chars with alert):



Posted 2014-01-01T04:57:34.797

Reputation: 151


C++ - 63 bytes

I'm not sure if this method has been used, but I designed this myself anyway:

int main(){std::cout<<int('&'*(','+'\t'));}


Posted 2014-01-01T04:57:34.797

Reputation: 505

You can use int instead of toascii for all of those to save a lot of characters. – Joe Z. – 2014-01-07T02:58:53.543

@JoeZ. OK, I didn't think of that. How can I calculate the bytes? – Hosch250 – 2014-01-07T02:59:48.053

Save your program as a text file, and then view how many bytes it is in the file manager. – Joe Z. – 2014-01-07T03:00:11.220

OK, thanks a lot. – Hosch250 – 2014-01-07T03:03:41.053

2 is not allowed. – Danko Durbić – 2014-01-07T07:46:59.197

Oops, I'll fix that. – Hosch250 – 2014-01-07T16:08:48.250

@DankoDurbić Fixed. – Hosch250 – 2014-01-07T16:10:16.863

I only count 62 bytes (using Also, can \t be replaced with the literal tab character?

– Justin – 2014-03-05T06:03:38.150

@Quincunx Literal tab character? – Hosch250 – 2014-03-05T06:07:11.050

@hosch250 is that not what \t stands for? (tab. #9 in ascii:

– Justin – 2014-03-05T06:13:31.173

@Quincunx Yes, I can use plain 9. However, I can have no numbers in my source code, so I cannot use 9 instead. TAB does not work. – Hosch250 – 2014-03-05T06:15:18.157


Clojure - 22

(apply *(map int"j#"))

(note: the # is ASCII character 19, Stack Overflow doesn't seem to like this but it's valid Clojure source...)

Clojure - 36

(dec(reduce +(nnext(range(int\@)))))


Posted 2014-01-01T04:57:34.797

Reputation: 843


vba (immediate window), 38 26 13

using regular ascii characters (no funny typing needed)






find a date that can be represented as a number, and select the year from that (in this case, Jan, 13, 2014)

have to use cdbl, as it assumes signed int, and overflows


Posted 2014-01-01T04:57:34.797

Reputation: 1 057

How do you write that in the Immediate window? (I assume that is what you mean by “direct window”.) If I copy-paste it I get “?year((cdbl(asc("e^"))*cdbl(asc("^(2)"))))”. (Copy-pasting “ê” and “²” from charmap.exe results “?” both.) And of course, that way the calculation not gives 2014. – manatwork – 2014-01-07T16:08:07.817

I used ?chr(234),chr(178) to get the characters, or you can hold down the ALT key and type 234 (and 178) and release the ALT to get each character – SeanC – 2014-01-07T16:31:23.603

With Alt+234 I get “r”, with Alt+178 I get “¦”. Of course, it works with the chr() function. Anyway, nice trick to use year() this way. – manatwork – 2014-01-07T16:41:29.913

ok.. I was thinking back to DOS days - now it's 0234 and 0178, but I found another shorter way now – SeanC – 2014-01-07T16:44:53.607

Thanks, it works this way. Although here appears “ȩ” and “¸”, the calculation is correct. – manatwork – 2014-01-07T16:59:31.070


Clojure, no unicode tricks (49 characters/bytes)

Uses the fact that * called with no args evaluates to 1:

(let[b(inc(*))j(+(* b b b)b)](+(* b j j j)j b b))

Using the same trick and doing string concatenation instead of arithmetic, the lowest I could get was 51 chars:

(let[n(*)t(+ n n)z(+)f(+ t t)](print(str t z n f)))


Posted 2014-01-01T04:57:34.797

Reputation: 153


Ruby 1.9, 10 bytes 

p 'ߞ'.ord


Posted 2014-01-01T04:57:34.797

Reputation: 11 060

These are 8 bytes in UTF8. – schmijos – 2017-07-24T14:42:36.130

nice! 7 chars if you are in the irb command prompt 'ߞ'.ord – Eduard Florinescu – 2014-01-08T16:54:48.760

@EduardFlorinescu Thanks, I know. – Timtech – 2014-01-08T21:38:43.083


Bash, 29 bytes

Bash without using external programs:

echo $((x=++y+y))$?$y$((x+x))

David Yaw

Posted 2014-01-01T04:57:34.797

Reputation: 911


Python, 23

print ord("<DC3>")*ord("j")

<DC3> should be replaced with ASCII symbol 19 (device control 3).


Posted 2014-01-01T04:57:34.797

Reputation: 1 377


SAS, 34 characters/bytes

data a;x=put(' ',hex.);put x;run;

That puts it to the log, it's 6 longer if you need it to the output window. Note I'm not seeing the second character there; it is backwards-P, which is hex 14.

There should be a shorter solution with %sysfunc(putc(..., but I can't get that to work properly.


Posted 2014-01-01T04:57:34.797

Reputation: 255


JavaScript 45



Posted 2014-01-01T04:57:34.797

Reputation: 1 189


Bash - 10 (or 8)

Well there have been a couple of answers that have been disqualified because they rely on the year. When golfing, one side goal is to see how close we can get to breaking the rules as currently written without breaking the letter of the rules (I include the clarifications by Joe Z in the 66 existing comments on the rules). The question very specifically states that I can not depend on 2014 being the current year. I instead rely on it being 8:14pm in my timezone.

date +%H%M 

When I ran it, it output 2014 exactly, thus it satisfies it No, it has to be 2014 exactly. comment. (Due to context people seem to misread it as ... 2014 always, but that was not what was written, even if that were perhaps what was intended.) This lets me beat the current Bash record, at least until this loophole is closed. This interpretation may seem too cheaty since all the existing popular answers assume that the rules really meant always. Indeed some of them exploit this and export something that isn't exactly 2014, but instead contains 2014. I am fine with that interpretation too since Bash can do:

cat /*/*

This is a mere 8 characters, which will concatenates a bunch of files including /dev/urandom/, and it generally takes my machine under a minute to find 2014 in /dev/urandom. Although my rule twisting golfing code of honour won't let me pick this solution since it violates the letter of Joe Z's clarification, the only objection Joe Z raised to the random approach in the 66 comments was that it was too long. At 8 characters this answer is actually shorter than my rules-lawyer answer.


Posted 2014-01-01T04:57:34.797

Reputation: 626

1Normally entries that explore edge cases are popular. This is the only answer they obeys the letter of the rules that is down voted (all other down voted answers rely on year=2014). Anyone care to comment on what rubs them wrong about this answer? – gmatht – 2014-04-08T00:59:09.303

It follows the letter of the rules in a way that's almost universally considered boring and unoriginal. Additionally, it was posted almost three months after the original problem, meaning that it's way back on the 4th page where barely anybody will see it, let alone vote it up. – Joe Z. – 2014-04-17T00:45:09.343

For that matter, I've edited the question again to make my intentions for the problem even clearer. Is "independently of any external variables" good enough? Even then, this answer isn't the shortest in either category, so I still won't accept it. – Joe Z. – 2014-04-17T00:46:59.303

Thanks. For the record, when I commented above this answer had been voted down to -2, so the context was more "would someone like to comment on why they are voting it down?" rather than "why isn't it upvoted?". It also wasn't intended as a criticism of Joe Z's question specification. – gmatht – 2014-05-04T13:04:14.423


Python, 55 bytes (no math import and no char or unicode trickery!)

x=False;a=x**x;b=a+a;c=b+b;print c**c*(c+c)-b**(c+a)-b

Uses the fact that zero to the zeroth power is defined as one and False can be implicitly casted to 0. Hence a, b and c will contain 1, 2 and 4 respectively.


Posted 2014-01-01T04:57:34.797

Reputation: 121

Arne, True implicitly casts to 1, so you can start with a=True and save 8 characters. Also, please specify Python 2. – isaacg – 2014-07-17T05:52:58.900


Marbelous 14


How it works

the first 4 lines are language literals, in hexadecimal. Their values are 203, 206, 207 and 205. They will fall down by one cell on each tick. If you perform an 8-bit binary not on those values (which is exactly what ~~ does) you get the following values: 52, 49, 48 and 50. These values happen to be the ascii values of 4, 1, 0 and 2 respectively. The literals then fall off the board which causes their corresponding ascii character to be printed to STDOUT.


Posted 2014-01-01T04:57:34.797

Reputation: 2 660


C, 27 Bytes


Just a reminder that multi-character constants do exist :)

Alternatively, three bytes more:

main(){printf("%x",' i'-'U');}


Posted 2014-01-01T04:57:34.797

Reputation: 126

main is not needed, you can shorten it to f and save 3 bytes, it'll still be a valid submission. – MD XF – 2017-05-12T19:53:01.907


  • int is not needed. 2. return doesn't print anything.
  • < – Dennis – 2014-09-16T15:07:59.180


  • '^GÞ' (character codes 7 and 222) would require only one multi-character constant.
  • < – Dennis – 2014-09-16T15:16:07.850

    My compiler does not agree :( – Gerwin – 2014-09-16T15:21:22.850

    That's odd. 7 * 256 + 222 = 2014, so it should work. What do you get? – Dennis – 2014-09-16T15:23:01.037

    6178782, it seems like my compiler thinks of ^ as a separate character. – Gerwin – 2014-09-16T15:26:14.280

    No, ^G is caret notation for BEL character; it's a single character with char code 7. You have to type the unprintable character somehow, depending on your OS and editor. – Dennis – 2014-09-16T15:28:17.763

    My compiler tells me it's '\aÞ'. Thanks anyway. – Gerwin – 2014-09-16T15:55:49.970


    Lua - 30 bytes

    b=#" "print(b..b-b..b/b..b+b)

    # is the length operator, so b = 2.


    Posted 2014-01-01T04:57:34.797

    Reputation: 81

    1Would b/b work? – Lynn – 2014-11-08T16:20:07.340

    @nooodl Good suggestion; indeed b/b can replace b-#" " and save 3 characters. – Seeker14491 – 2014-11-10T00:56:59.370


    (Java, 553 bytes as .class, 112 bytes as it stands, 84 bytes after renaming the class to 'm' and removing whitespace.)

    This probably isn't the kind of answer you're looking for, but there are a bunch of strings that share a hashcode of 2014.

    public class make2014 {
        public static void main(String[] args){

    John P

    Posted 2014-01-01T04:57:34.797

    Reputation: 381

    1Consider adding the language name (Java, I assume) and byte count like the other answers do. – NinjaBearMonkey – 2014-09-20T16:31:20.777

    Thanks, I forgot to do that. I didn't think my file size would matter much - the minimum file size of a .class is far greater than most of the attempts here. – John P – 2014-09-20T21:43:15.493

    I got the .java down to 84 bytes without changing functionality. I see other people shaved off 9 bytes by printing special characters to produce 2014 instead of using hashcodes... I kind of thought it would be cheating to do it like that, since you're really printing 2014 as a number in a different format. Oh well. – John P – 2014-09-20T21:50:40.717


    TinyMUSH, 16

    We need more MUD language entries.



    Posted 2014-01-01T04:57:34.797

    Reputation: 419


    C++ 30



    Posted 2014-01-01T04:57:34.797

    Reputation: 1 185

    Why do you need the brackets around '&amp;'? Does main(){cout&lt;&lt;'&amp;'*(']'-'(');} not work? – Joe Z. – 2015-03-24T07:39:15.007


    x86 machine code, 19 bytes

    B8 3A 0E 2C 08 CD 10 2C 02 CD 10 04 01 CD 10 04 04 CD 10

    Assembly code equivalent:

    mov ax, 0E3Ah; ah = 0Eh (bios teletype), al = 3Ah (ascii semicolon)
    sub al, 08h; ascii 2
    int 10h
    sub al, 02h; ascii 0
    int 10h
    add al, 01h; ascii 1
    int 10h
    add al, 04h; ascii 5
    int 10h

    Yeah, I know: it logs 2015 rather than 2014.

    But seeing that this challenge is old and now the year is 2015, it seemed more appropriate to use the current year (it's my excuse for not "going home" :) )

    Note: This was tested using DOSBOX


    Posted 2014-01-01T04:57:34.797

    Reputation: 178

    You have numbers in your source. – Elliot A. – 2016-01-31T11:06:14.133

    @ElliotA. Read the challenge: "without using any of the characters 0123456789"; numbers = characters representing numbers. – SirPython – 2016-01-31T21:49:13.510


    CMD - 42 bytes


    The 'trick' is that when using the /a switch on the set command, letters (and other invalid characters) are evaluated as 0. I then just use hexadecimal to evaluate 2014. The 0 is needed because in CMD hexadecimal must be expressed with the leading 0x. There is almost definitely a shorter way to get to 2014...

    %a%xAAA - %a%xFF - %a%xFF - %a%xCE = 2730 - 255 - 255 - 206 = 2014


    Posted 2014-01-01T04:57:34.797

    Reputation: 1 806


    JavaScript (19)

    Obvious cheating, but these expression ran in REPL print strings "2014" and "2015":

    ''+'ߞ'.charCodeAt() // 2014
    ''+'ߟ'.charCodeAt() //2015

    TIL: .charCodeAt implicitly converts it's first argument to 0.


    Posted 2014-01-01T04:57:34.797

    Reputation: 197


    Vitsy, 5 4 Bytes, 3 Characters

    When in Rome...


    Get the character with the value 2014 and then print it as a number. Simple.

    More Interesting Version (12 10 9 Bytes):


    My language supports hexadecimal, too. ;)

    "         Capture the entire source as string by looping around the source.
     ca-      Push 2 to the stack
        ^     45^2
         b-   -11
           N  Output as a number.
            - Only here for character value 45.

    Addison Crump

    Posted 2014-01-01T04:57:34.797

    Reputation: 8 084

    Am I right that this language is newer than the question? Besides, I believe this question is already 'closed'(winner chosen, and even an edit at the start discouraging more replies) – Sanchises – 2015-11-01T11:42:26.327

    @sanchises You're absolutely right - I'll pull my edit request. I'd still like to add it to the list, though, even if marked as a new language.. :D – Addison Crump – 2015-11-01T11:46:12.780

    Just put it under 'invalid' I guess, there's a section for that at the end. – Sanchises – 2015-11-01T11:49:00.107

    Changed the edit suggestion. :P Forgot about the 'newer than question' thing, but I should've considered that. Thanks, @sanchises – Addison Crump – 2015-11-01T11:50:08.600


    Perl 5, 8 28 bytes

    say 38*53

    Seems to do it.

    Oh, without cheating ?


    Dale Johnson

    Posted 2014-01-01T04:57:34.797

    Reputation: 509

    D'oh. I thought it was without any of those numbers. – Dale Johnson – 2015-12-02T04:24:58.003


    T-SQL 27 bytes

    PRINT ASCII('')*ASCII('j') 

    Note that the character that isn't rendered here is the DC3 (CHAR(19)) in the first set of quote marks. It's unicode U+009F which, it would appear, doesn't copy and paste here too well but I can assure you it works in SQL Management Studio.

    Steve Matthews

    Posted 2014-01-01T04:57:34.797

    Reputation: 121


    Quetzalcoatl, 11 4 5 bytes

    Noncompeting because this language is from 2016.


    The box should be replaced by Unicode character 2014.


    This is for an old version of Quetzalcoatl. New version:



    Posted 2014-01-01T04:57:34.797

    Reputation: 1 341

    This language is new though, this year. – NoOneIsHere – 2016-03-02T22:53:25.030

    There is no ASCII character 2014... it has to be Unicode to go that high. – mbomb007 – 2016-03-04T19:40:13.443

    If Quetzalcoatl is newer than the challenge, you're answer is non-competing and should say so in its body. Also, I'm not aware of any encoding in which ߞ would be a single byte. – Dennis – 2016-04-08T17:21:13.733


    SMBF, 15 bytes

    \x00 is a literal NUL byte. This program adds 5 to each of /,+- and prints.


    Only my Python interpreter can accept non-printable ASCII. Change the data line to this, and substitute the code you want to run with the non-printable values escaped (on line 169):

    data = bytearray(b'the above code goes here')


    Posted 2014-01-01T04:57:34.797

    Reputation: 16 876


    Retina, 24 bytes (newer than challenge)

    Note the trailing space on lines 2 and 3. Language is newer than the challenge.

    xx  x xxxx 

    Try it online


    Posted 2014-01-01T04:57:34.797

    Reputation: 16 876


    Mathematica, 10 bytes


    Prints the decimal expansion of the number e to over 3.8 million decimal places. The first occurrence of 2014 in that decimal expansion starts at the 3180th decimal place.

    Greg Martin

    Posted 2014-01-01T04:57:34.797

    Reputation: 12 159


    VBA, 21 characters


    Write and run the above code in the Immediate Window. Basically, the code converts column name BYL to its column index (2014).

    Anastasiya-Romanova 秀

    Posted 2014-01-01T04:57:34.797

    Reputation: 1 481

    For future reference, this may be rewritten as ?[BYL:BYL].Column – Taylor Scott – 2017-09-03T21:04:26.123


    Straw, 13 bytes (non-competing)

    Non-competing because the language is 2 years newer than the question...


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

    Try it online


    Posted 2014-01-01T04:57:34.797

    Reputation: 3 661


    Actually, 15 bytes

    This language was created long after this challenge was made, but I thought I'd still try my hand at it. This answer avoids all numerals, including Actually's ² for a*a. Golfing suggestions welcome. Try it online!



    ╜    Push register 0 (initialized to 0).
    ⌐u   Add 2 and increment. Returns 3.
    ;*   Duplicate and multiply. Equivalent to squaring. Returns 9.
    ⌐    Add 2 again. Returns 11.
    úl   Pushes the lowercase alphabet and gets its length. Returns 26.
    ¬¬   Subtracts 2 twice. Returns 22.
    τ    double(). Returns 44.
    u    Increment. Returns 45.
    ;*   Square. Returns 2025.
    -    Subtract. Returns 2025 - 11 == 2014.


    Posted 2014-01-01T04:57:34.797

    Reputation: 7 604


    Pushy, 6 bytes


    Contains control characters, so here's a hexdump:

    0000-0006:  60 14 0e 60 6a 23

    The first unprintable is the literal DC4 byte (\x14), and the second is SHIFT-OUT (\x0e).

    First these bytes are pushed as charcodes, so the stack is [20, 14]. The j operator concatenates these and # outputs the result: "2014".

    10-byte solution:


    Uses char-code manipulation and the builtin T (10).

    `<:;>`       Push string as char-codes: [60, 58, 59, 62]
         KT-     Take 10 from each: [50, 48, 49, 52]
            "    Interpret as char-codes and print: results in "2014"


    Posted 2014-01-01T04:57:34.797

    Reputation: 8 743


    Pyke, 3 bytes, noncompetitive

    Try it here!

    Where ߾ is 0xDFBE

    Loads ord(0xDFBD-0x20) as an integer and implicit prints it


    Posted 2014-01-01T04:57:34.797

    Reputation: 22 461

    How does it work? – Pavel – 2016-12-13T04:04:06.843

    @Pavel explanation added – Blue – 2016-12-13T07:35:11.363


    tcl, 16

    puts [scan ߞ %c]

    Can be seen on:


    Posted 2014-01-01T04:57:34.797

    Reputation: 1 831


    Groovy, casting to int, 8 bytes


    Matias Bjarland

    Posted 2014-01-01T04:57:34.797

    Reputation: 251


    C, 25 bytes


    24 characters, but one character is UTF-8 encoded. Still the shortest C answer! How it works:


    7DE in decimal is 2014.

    MD XF

    Posted 2014-01-01T04:57:34.797

    Reputation: 8 337


    Python 3, 16 Bytes :


    2017 version, 16 Bytes :


    Mr Geek

    Posted 2014-01-01T04:57:34.797

    Reputation: 181


    Python - 23 Bytes

    print ord('&')*ord('5')

    Mark Bell

    Posted 2014-01-01T04:57:34.797

    Reputation: 109

    2The 5 is a number. – ppperry – 2017-08-31T20:39:40.540


    Whitespace, 19 bytes

    Visible representation:


    Just pushes 2014 onto the stack and prints it. Whitespace's lack of any visible characters makes this pretty easy.

    Valid as numbers are completely valid tokens in whitespace, they just don't do anything.


    Posted 2014-01-01T04:57:34.797

    Reputation: 716


    Common Lisp, 15 characters

    (char-code #\ߞ)

    Try it online!


    Posted 2014-01-01T04:57:34.797

    Reputation: 1 230


    Ruby (8 bytes, 7 chars)


    The question mark is ߞ represented in two bytes UTF8.

    Short Ruby


    Posted 2014-01-01T04:57:34.797

    Reputation: 103

    Duplicate of O-I's Ruby solution posted 3.5 years earlier.

    – manatwork – 2017-07-24T09:24:57.533

    @manatwork Duplicate answers are allowed.

    – Martin Ender – 2017-07-24T10:44:08.340

    I didn't said they aren't. Neither downvoted or flagged. (Just for the record, I never agreed with that rule. And never will.) But I think would be more enjoyable to avoid duplicated solutions. Especially on a question that already has 263 answers. – manatwork – 2017-07-24T11:03:30.777

    Hm... hard to find the old solutions. But actually his solution is 9 bytes because the codepoints representations need 2 bytes. – schmijos – 2017-07-24T12:58:02.617

    Btw: Having seen the solution of @o-i : ?ߞ.ord would then be only 7 bytes, right? – schmijos – 2017-07-24T13:05:15.750

    1Initially O-I's solution was also 'ߞ'.ord, but then be updated because the requirement says to “prints the number 2014”. The general rule (which can be overridden by each challenge) is that solutions must handle input and output either themselves explicitly or benefit the interpreter's service if it has such thing like ruby's -n or -p. Code that expects input to be readily available in the memory or just leaves the value they produce in the memory are called snippets and generally are not accepted as solutions. – manatwork – 2017-07-24T14:29:48.217

    BTW, looks like neither Timtech found O-I's solution and posted his own after just 1 week. I assume there were considerably fewer solutions that time.

    – manatwork – 2017-07-24T14:35:35.270


    Clojure - 35 characters ASCII only


    Based on True Soft's answer


    Posted 2014-01-01T04:57:34.797

    Reputation: 211


    Lua, 27 bytes

    Should work in Lua 5.1, Lua 5.2, and Lua 5.3.


    Try it online!

    This is mean to be saved with the UTF-8 encoding. The first byte of the string is 201, and its length is four. Lua is mostly encoding agnostic, so as long as these things are true in whatever encoding, it works.

    With only ASCII, 28 bytes:


    Note: the string must contain ASCII 20 and ASCII 14 (which are not printable characters). y here is an undefined variable, so it is nil, which byte defaults to 1 in the first parameter.


    Posted 2014-01-01T04:57:34.797

    Reputation: 436


    Aceto, 10 bytes


    Try it online!

    Uses int(Pi) to it's advantage

    11 bytes (previous answer)


    Try it online!

    Simply increments from zero 2, 0, 1, and 4 times, then prints each time

    Fun Version


    Try it online!

    Uses int(Pi) to base equations off of

    Lame Version


    Try it online!

    Converts the codepoint to number, which is 2014


    Posted 2014-01-01T04:57:34.797

    Reputation: 1


    Implicit, 3 bytes

    Try it online!

         implicit push command
    `    character
     ߞ   U+07DE (2014 in decimal)
         implicit integer output

    MD XF

    Posted 2014-01-01T04:57:34.797

    Reputation: 8 337


    Triangularity, 18 bytes

    .. ..

    Try it online!

    Mr. Xcoder

    Posted 2014-01-01T04:57:34.797

    Reputation: 24 203


    Pyt, 16 bytes



    á                               Push stack into list (pushes empty list)
     Ł                              Get length of top of stack (0)
      !                             0!=1
       ⁺²                           (1+1)^2=4
         Đ                          Duplicate top of stack
          ⁺⁺!                       (4+2)!=720
             ₀⁻⁻                    720/10-2=70
                ⇹                   Swap top two items on stack (4 is on top)
                 ᴇ                  10^4=10000
                  +₅                (10000+70)/5=2014

    Try it online!


    Posted 2014-01-01T04:57:34.797

    Reputation: 655




    More readable version:

    > Move pointer pos over
    ++++++++++ Add 10
    [ Start loop
    <+++++>- Add 5, move over & subtract 1
    ] End loop
    <.--.+.+++. Do some other stuff

    Yes, I know this is an old post, but I'm really bored and want to get enough rep to comment because I don't have access to my other account.


    Posted 2014-01-01T04:57:34.797

    Reputation: 9

    Welcome to PPC...Jk – tfbninja – 2018-01-12T03:11:19.593


    Brainfuck, 23 Bytes


    Try it online!


    Posted 2014-01-01T04:57:34.797

    Reputation: 81


    PHP, 25 bytes


    Agnius Vasiliauskas

    Posted 2014-01-01T04:57:34.797

    Reputation: 109

    This requires the IntlChar library; and that´s a lot younger than the question. Nice idea, though. – Titus – 2018-03-10T01:31:49.937

    Thanks. Can be solved without using IntlChar library with preg_replace('#\D#','',json_encode('—')). Pick your number from a unicode table :-) – Agnius Vasiliauskas – 2018-03-10T12:08:29.453


    Pyt, 9 bytes


    Try it online!


    Posted 2014-01-01T04:57:34.797

    Reputation: 1


    SNOBOL4 (CSNOBOL4), 42 bytes

    	&UCASE 'N' @X ARB 'T' @Y
    	OUTPUT =Y X

    Try it online!

    @ assigns the index of the match and (space) concatenates them.

    I know, it's 2018, so I should go home...


    Posted 2014-01-01T04:57:34.797

    Reputation: 10 084


    Python 3, 16 bytes


    Try it online!


    Posted 2014-01-01T04:57:34.797

    Reputation: 316


    Perl 5 + Perligata, 25 bytes

    Byte count uses the new rule that command-line switches for choosing appropriate modules don't count.

    perl -MLingua::Romana::Perligata -e'MMXIVimum egresso scribe.'

    Tested in Strawberry 5.26.0 with Perligata 0.601 (with " instead of ' in the above code).


    Posted 2014-01-01T04:57:34.797

    Reputation: 2 244


    GTB, 38


    Compile assuming : at front


    Posted 2014-01-01T04:57:34.797

    Reputation: 11 060

    π is 2 bytes and is 3, bringing the byte count to 49. – Joe Z. – 2014-01-07T02:18:28.000

    @JoeZ. All characters at are 1 byte.

    – Timtech – 2014-01-07T12:10:20.987


    C# (56 characters)

    Class P{static void Main(){Console.Write(','*','+'N');}} 

    Merin Nakarmi

    Posted 2014-01-01T04:57:34.797

    Reputation: 227

    This doesn't print anything. – shamp00 – 2014-01-05T15:05:17.700

    26 characters = 4 bytes?? I don't think so... – Jubobs – 2014-01-06T12:24:21.490

    Sorry. I just included the logic only. Now I included the whole program. – Merin Nakarmi – 2014-01-07T03:34:18.220

    You need System.Console to use Console. – shamp00 – 2014-01-08T14:24:47.447

    using System; will be on the header. So.... – Merin Nakarmi – 2014-01-08T17:50:00.877


    Perl, 24 bytes

    print-ord(A)+ord for U,O

    Pure ascii, no nonprinting characters or utf8-only characters used. Uses the 21st and 15th letters of the alphabet to print 20, 14.


    Posted 2014-01-01T04:57:34.797

    Reputation: 21


    BAT (windows batch), 7 characters

    echo %*

    save as a.bat and invoke as a 2014

    is there any restriction on using command line parameters? – Einacio

    I don't think so, but echo $1 still has a number in it. – Joe Z.

    not a so valid answer, but noone was posting an answer in this wonderful language


    Posted 2014-01-01T04:57:34.797

    Reputation: 406

    Does BAT have an equivalent to sh’s $@ for “all parameters”? – Zev Eisenberg – 2014-01-10T23:29:33.147

    @ZevEisenberg that's what i used, altought it seems someone didn't like it – Einacio – 2014-01-13T15:14:43.497


    k 11 & 17 chars

    this 11-char one is from a colleague


    this 17-char one is the best i could come up with on my own; it's a variant on ASCII abuse:


    and just for interest, here are a few others of mine:

    ."c"$"RPQT"-"e"$" " / ascii (only 2.x)
    ."c"$-/"e"$("RPQT";" ") / ascii (all versions)
    -_-(s*(exp acos@-`=`)xexp x)-(s xexp s:x*x)%x:+/``=`` / port of David Carraher's solution above
    .,/$#:'(``;();`;````) / another approach

    Aaron Davies

    Posted 2014-01-01T04:57:34.797

    Reputation: 831

    @David Carraher my latest improvements on my port of your algo--two implementations, both 39 chars:

    -_-(x*p*p:exp acos@-#`)-f*x*x*x:f*f:#``
    f+(x*_p*p:exp acos@-#`)-f*x*x*x:f*f:#``

    (i don't have the rep to comment on your post yet) – Aaron Davies – 2014-01-10T02:02:03.027


    PHP (27) - not shortest ASCII PHP but more readable


    brother Filip

    Posted 2014-01-01T04:57:34.797

    Reputation: 31


    Bash, 15 bytes

    echo "^T "|od -x

    (^T is one character.)

    Kevin Fegan

    Posted 2014-01-01T04:57:34.797

    Reputation: 121


    Bat (Windows batch), 13 bytes (characters)

    echo.^T |od -x

    (^T is one character.)

    Kevin Fegan

    Posted 2014-01-01T04:57:34.797

    Reputation: 121



    print(str(len('Happy new year to me')) + str(len('Happy new year')))

    Oliver Ni

    Posted 2014-01-01T04:57:34.797

    Reputation: 6 425

    This has a 1 in it. – Joe Z. – 2014-01-11T23:16:32.597

    oh whoops let me fix it – Oliver Ni – 2014-01-11T23:17:52.873

    1Must str('Happy new year') be wroted as str(len('Happy new year'))? – AMK – 2014-01-11T23:28:14.173

    sorry. I fixed it. – Oliver Ni – 2014-01-13T04:53:30.753


    PHP, 22 bytes

    echo ord('').ord('')


    SE is stripping the characters. Working version here:


    Posted 2014-01-01T04:57:34.797

    Reputation: 204

    this produces "00" when I run it. Please explain. – Darren Stone – 2014-01-14T20:32:21.080

    SE is stripping the characters. Added a codepad example. – MichaelRushton – 2014-01-14T22:40:51.837

    You can swap out echo with &lt;?=, to make it 2 characters shorter. – cjfaure – 2014-02-08T19:36:44.783


    Edited: bash 81 chars!

    Just for fun:

    wc -c < <(echo {,}{,,}{,}{,,,}{,}{,,,}film dbugjkqstvxz{,}{,,} 'Happy New Year!')

    there is no numbers, all letters are used and this print exactly:


    ( This method could reasonably be used until 2016: by just adding one or two exclamation point after the wish:

       wc -c < <(echo {,}{,,}{,}{,,,}{,}{,,,}film dbugjkqstvxz{,}{,,} 'Happy New Year!!')


    bash 27 chars

    .;v=$?;echo $v$?${#v}$[v+v]

    This will output:

    bash: .: filename argument required
    .: usage: . filename [arguments]

    Ok, this will generate some unwanted output, but 2014 is printed and is a valid token!

    The two following sample are error free (a little longer but near golfed)

    v=$(echo {V..v});echo $[${#v}#vu]


    printf -vv "%d" $?xfbc;echo $[v>>${#?}]

    or even:

    echo $[$[$[${#?}$?-${#?}]$?>>${#?}]#Iy]

    F. Hauri

    Posted 2014-01-01T04:57:34.797

    Reputation: 2 111


    Delphi (26bytes & 26 chars)


    Ascii values
    - : 45
    / : 47
    e : 101
    45*47 = 2115 - 101 = 2014

    Teun Pronk

    Posted 2014-01-01T04:57:34.797

    Reputation: 1 874


    e-TeX, 21 bytes


    It contains an invisible control character with code 19 (0x13) before the asterisk. A version with printable ASCII characters needs two more bytes:


    In TeX ` takes the character code of the next token:

    • [0x13] (^^S): 19
    • j: 106

    \numexpr calculates: 19 * 106 = 2014

    The result is a DVI file with "2014" on the first page.

    Variant with 2014 as page number:


    (25 bytes, if ^^S is replaced by the byte with character code 19).

    Heiko Oberdiek

    Posted 2014-01-01T04:57:34.797

    Reputation: 3 751


    Java without the weird unicode charas @ 115

    enum A{A;public static void main(String[]z){int a=A.ordinal(),b=a++;System.out.print(""+(a<<a)+b+a+(a<<(a<<a)));}}

    enumerators are pretty handy :)


    Posted 2014-01-01T04:57:34.797

    Reputation: 3 346


    Python, 8 characters


    I think this ought to be valid :P

    Ok, if you want me to use print(),

    15 characters



    Posted 2014-01-01T04:57:34.797

    Reputation: 467


    C#, 4 characters, 5 bytes


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


    Posted 2014-01-01T04:57:34.797

    Reputation: 240

    1It's 4 characters, yes, but 5 bytes. – Joe Z. – 2014-09-20T17:37:56.573

    @JoeZ. ok, updated to reflect the number of bytes. Still way better than previous 63 and 64 bytes solutions. – Cœur – 2014-09-21T17:45:24.563


    Xojo, 27 chars (all ASCII)

    MsgBox Str(&hFBC/(&hC-&hA))


    Posted 2014-01-01T04:57:34.797

    Reputation: 79


    Microscript, 10 bytes

    Noncompeting, language postdates the question..


    Explanation: 106*(59-40), using the language's equivalent of character literals. I'd do 53*38, but the character corresponding to 53... is the digit 5. And the character corresponding to 19 is, of course, nonprintable, so that wouldn't work.


    Posted 2014-01-01T04:57:34.797

    Reputation: 9 433


    Cardinal, 14 chars


    The pointer starts at %, reads in the character ‘d’(ASCII 100), creates a duplicate as inactive value (the bottom of the stack), adds active and inactive values, resulting in 200, adds 1, prints out the result 201, subtracts one, divides by inactive value (100), resulting in 2, adds two, prints out 4. Cardinal pointer stacks can only carry values up to 255 (OEM 437 range), everything above leads to a wrap-around.

    0             100             100             200             201
    0               0             100             100             100
    >n=*+.-d++.    %>=*+.-d++.    %n>*+.-d++.    %n=>+.-d++.    %n=*>.-d++.
     d              d              d              d              d
       201             200               2               3               4
       100             100             100             100             100
    %n=*+>-d++.    %n=*+.>d++.    %n=*+.->++.    %n=*+.-d>+.    %n=*+.-d+>.


    Executing program..
    Execution complete.

    M L

    Posted 2014-01-01T04:57:34.797

    Reputation: 2 445


    C, 24 / 68


    Haha, Roman Numerals For The Win!

    Or, for real:


    Albert Renshaw

    Posted 2014-01-01T04:57:34.797

    Reputation: 1 978


    q, 20 17 bytes


    Alexander Belopolsky

    Posted 2014-01-01T04:57:34.797

    Reputation: 191


    TeaScript, 7 bytes


    Takes the char code of the character with a char code of 2014


    Posted 2014-01-01T04:57:34.797

    Reputation: 20 837


    Groovy, 48 bytes

    For 2015 change cabe to cabf...


    K. Klassen

    Posted 2014-01-01T04:57:34.797

    Reputation: 111


    Factor, 10 bytes

    Not gonna beat my winning answer, but as a follow-on to the other "2014th Unicode char" answers:

    CHAR: ߞ .

    Prints 2014.


    Posted 2014-01-01T04:57:34.797

    Reputation: 4 037


    Base64, 9 Bytes


    (You can encode it with: echo MjAxNA==== |base64 -d)


    Posted 2014-01-01T04:57:34.797

    Reputation: 109


    JavaScript, 17 Bytes



    Posted 2014-01-01T04:57:34.797

    Reputation: 109


    Jelly, 10 bytes (non-competing)



    ⁹            Set the current value to 256.
     ⁴×          Multiply by 16. The current value is now 4096.
       H         Divide by 2. The current value is now 2048.
        _⁴Ḥ¤     Subtract by 16/2. The current value is now 2016.
            ’’   Decrement twice. The current value is now 2014.


    Posted 2014-01-01T04:57:34.797

    Reputation: 5 992


    C (gcc 5.3.1), 49 bytes

    Pure arithmetic! \o/


    Undefined behaviours.

    Specifically, use this compiler (languages are defined by implementation).

    Without undefined behaviour (which would work on all compilers), 51 bytes



    Basically 2048 - 32 - 2, constructed using powers of 2.

    Leaky Nun

    Posted 2014-01-01T04:57:34.797

    Reputation: 37 559


    Swift 2.2, 28 bytes


    Falling back on Darwin/glibc error codes from errno.h.


    Posted 2014-01-01T04:57:34.797

    Reputation: 284


    Mathematica, 16 bytes



    Posted 2014-01-01T04:57:34.797



    QBIC, 10 bytes - Not Competing


    Calculates 2014 from the pre-initialised variables q-z (1-10) and prints it. Development of QBIC started some two years after 2014...

    Alternative 12-byte version:



    Posted 2014-01-01T04:57:34.797

    Reputation: 6 474


    C, 29 bytes (Emacs) / 40 bytes (VI)

    Before creating program, execute the shell command

    stty -ixon      ### 11 bytes, with the newline

    N.B this is required for most terminal editors, but is not required for emacs

    then write this code:


    N.B. '^S' is a single XOFF character e.g. in VI use control-V, control-S; in emacs use control-Q, control-S; emacs turns off flow control by default.

    I assume the comment [You can't type ^S in a Linux terminal] below left off an implied [without the stty command or equivalent e.g. emacs default behavior upon startup], otherwise that comment is inaccurate.

    And here is the requested hexdump:

    $ od -a -t x1 x.c
    0000000   m   a   i   n   (   )   {   p   r   i   n   t   f   (   "   %
             6d  61  69  6e  28  29  7b  70  72  69  6e  74  66  28  22  25
    0000020   d   "   ,   '   j   '   *   ' dc3   '   )   ;   }  nl
             64  22  2c  27  6a  27  2a  27  13  27  29  3b  7d  0a

    Brian Carcich

    Posted 2014-01-01T04:57:34.797

    Reputation: 27

    2This isn't a valid answer. You have to count the shell command also, since it's a non-standard configuration. Also, if you have unprintables in your code, you should include a hexdump, for extra clarity. – Mego – 2016-09-27T15:46:01.797

    You can't type ^S in a Linux terminal. -1 – MD XF – 2017-05-21T23:37:40.480

    There is more than one way to ^Skin a cat, so these comments are incorrect as written; I clarified my post to address the confusion these folks (and others) may be having. It's still 29 if you use emacs as an editor. MD XF: how do you enter your [U+07DE] character into C-source; also, my compiler throws an error when replacing [main()] with [f()] (excluding the obvious gcc -Df=main hack), but if there is a compiler that accepts [f()], then all C source scores drop by 3. So you need to bump your score by 3, or reduce all other C solutions. – Brian Carcich – 2017-05-22T14:29:36.393