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

    are likely to be poorly received. Try using the

    to get feedback on if you want to post a similar challenge.

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

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

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

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


    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>

    Even though numbers are ignored in brainfuck, I thought I'd post one anyway. 32 Chars: `++++++[>++++++++<-]>++.--.+.+++.`

    Brainfuck isn't a valid language for this challenge.

    I know. That's why I posted it as a comment

    I wonder if this question gets a small spike in popularity around New Year's.

    Waiting for "Come on folks, don't you realize it's 2016?" :)

    @cagirici Done.

    @BradenBest It's possible to do it in 31 characters in at least two different ways: +++++++[>+++++++<-]>+.--.+.+++. and ++++++++++[>+++++<-]>.--.+.+++.

    @JoeZ. It's almost that time of the year again.

    possible to do the brainfuck answer in 23 bytes `-[>+<-----]>-.--.+.+++.`

    That language is full of language!

    `(unsigned char)'\xca'*'\xa'` for 2020 in C.

    Locomotive basic (Amstrad CPC): `?ASC("-")*ASC("-")-&b`, 22 bytes. (Cannot asnwer since the question is protected)

    The question text says "any language in which numbers are valid tokens". Since any character that is not an instruction is a comment in BF, numbers are valid therein. Though admittedly you could go into a philosophical debate over whether digits count as tokens or whitespace in such a language.

  • cat

    cat Correct answer

    5 years ago

    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.

    Wow, this is an amazing find so much later after the challenge. And with a language so esoteric nobody here had heard of it yet!

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

    BTW: this does the same thing as CJam's `KE`, but is actually valid because it's a language from before 2014.

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

    Also this solution will work until 2025 at least, until you pass U!Z!.

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

    This a game of @cat and Mouse-2002.

    @DigitalTrauma indeed :3

    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.

    @JoeZ, that's... that's kinda what I've done. ;)

License under CC-BY-SA with attribution

Content dated before 7/24/2021 11:53 AM