620
\$\begingroup\$

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


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

Woo, 10 years of this challenge!

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.


Leaderboard:

var QUESTION_ID=17005,OVERRIDE_USER=7110;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+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}}",e.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,link:e.link}});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}}",o.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="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <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>

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

328 Answers 328

1 2
3
4 5
11
5
\$\begingroup\$

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:

i2014
\$\endgroup\$
9
  • \$\begingroup\$ It's 2010 for me instead \$\endgroup\$
    – user41805
    Dec 18, 2016 at 13:17
  • \$\begingroup\$ @KritixiLithos Weird, it works for me. What help page does :h os_v open for you? \$\endgroup\$
    – xenia
    Dec 18, 2016 at 13:18
  • 1
    \$\begingroup\$ It opens os_vms.txt says Vim version 7.3 and last change was made in 2010 Jul 8 \$\endgroup\$
    – user41805
    Dec 18, 2016 at 13:24
  • \$\begingroup\$ What version of Vim are you using? \$\endgroup\$
    – xenia
    Dec 18, 2016 at 13:26
  • 2
    \$\begingroup\$ If numbers were allowed you could just do i2014. :P \$\endgroup\$
    – Joe Z.
    Dec 18, 2016 at 21:01
5
\$\begingroup\$

Javascript, 37 bytes

((_=+!![])<<''+_+''+_)-(_<<_+++_+_)-_

It's not code golf until someone bitshifts.

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

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
\$\endgroup\$
1
  • 2
    \$\begingroup\$ That looks so much like Brainfuck. \$\endgroup\$
    – Joe Z.
    Oct 19, 2014 at 14:59
5
\$\begingroup\$

TI-BASIC, 12 bytes

A completely new approach.

iPart(π+iPart(e)sinh(π+√(π

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

\$\endgroup\$
5
\$\begingroup\$

Javascript, 6 characters (8 bytes)

I never saw any rule saying we had to produce the number 2014 in the absence of any other output.
(Nor anything about not outputting to an error, but that's more obvious.)

new`—`

For me, on Firefox Nightly, this produces TypeError: "\u2014" is not a constructor, which contains the number 2014.

(If it isn't obvious, this happens because the em dash, —, is U+2014. Or, in other terms, it's the unicode character that can be represented by the hexadecimal number 2014.)

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Yes, but... Simply yield Uncaught SyntaxError: illegal character U+2014 on my Firefox. \$\endgroup\$
    – tsh
    Nov 3, 2021 at 6:11
4
\$\begingroup\$

Ruby:

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

Here is how it works inside IRB shell:

>> p eval("#{""=~//}x#{"\a".ord}de")
2014
\$\endgroup\$
4
\$\begingroup\$

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.

<:<:+/i.*:+~+~p:%_
\$\endgroup\$
1
  • \$\begingroup\$ You could save two bytes <:<:+/i.*:+~dyad \$\endgroup\$
    – FrownyFrog
    Nov 18, 2017 at 16:50
4
\$\begingroup\$

Multiboot x86 Assembly (250 bytes):

[BITS N]
%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)
h:
dd M
dd F
dd C
dd h+O
dd h+O
dq 'a'-'a'
dd s+O
s:
mov eax,'\'<<`\r`
L('HBJB')
add eax,'e'-'a'
L('IBFB')
hlt

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)

\$\endgroup\$
1
  • 1
    \$\begingroup\$ You 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. \$\endgroup\$
    – Joe Z.
    Jan 7, 2014 at 2:48
4
\$\begingroup\$

Javascript: 47 characters

Not the shortest, but another solution:

$ node
> [!+[]+!+[]]+[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]]
"2014"

Source

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

\$\endgroup\$
0
4
\$\begingroup\$

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.com 2014.asm
dosbox 2014.com
\$\endgroup\$
2
  • 1
    \$\begingroup\$ I think it shouldn't have any characters [0..9] in your code \$\endgroup\$
    – Teun Pronk
    Jan 31, 2014 at 14:56
  • \$\begingroup\$ @TeunPronk but that's the generation code, not the submission -- the submission is the binary \$\endgroup\$
    – cat
    Apr 15, 2016 at 23:47
4
\$\begingroup\$

TI-Basic, 49 41 31

π/π+π/π→B:B^B^B→C:C^C(C/B)-CB-B

Explanation

  • π/π+π/π→B Store 2 in B
  • :B^B^B→C Store 16 in C
  • :C^C(C/B)-CB-B Display 2014
\$\endgroup\$
7
  • \$\begingroup\$ I'm up voting on the assumption this works; I have no way to test it. \$\endgroup\$ Jan 3, 2014 at 12:59
  • \$\begingroup\$ @MichaelStern Explanation added :) \$\endgroup\$
    – Timtech
    Jan 3, 2014 at 15:22
  • \$\begingroup\$ :π/π+π/π→B:B^B^B→C:Disp C^C*(C/B)-C*B-B would be 2 characters shorter. \$\endgroup\$ Jan 8, 2014 at 11:02
  • \$\begingroup\$ @MichaelMadsen Thanks, updated! \$\endgroup\$
    – Timtech
    Jan 8, 2014 at 11:49
  • \$\begingroup\$ 8 bytes can be saved with various tweaks: iPart(e→B:BBBB:Ans^B(Ans/B)-AnsB-B \$\endgroup\$ Nov 18, 2017 at 20:12
4
\$\begingroup\$

awk (28)

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

BEGIN{print++I+I--I++I++I*I}

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

BEGIN{print++I+I--I++I++I+I}

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

(tested with gawk and mawk)

\$\endgroup\$
1
  • \$\begingroup\$ A different use of variables that saves one byte: BEGIN{print++I+I J++I++I*I} \$\endgroup\$ Jan 19, 2021 at 0:57
4
\$\begingroup\$

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.

\$\endgroup\$
4
\$\begingroup\$

Windows Calculator - 5 characters

Inspired by this answer to a different question.

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

DFEC±

This is what the result looks like.

enter image description here

\$\endgroup\$
2
  • 5
    \$\begingroup\$ If you change the size to Word, it will be an almost-valid answer that will output only 2014 \$\endgroup\$ Jan 9, 2015 at 11:49
  • \$\begingroup\$ I don't think this is a programming language... \$\endgroup\$
    – cat
    Apr 7, 2016 at 14:40
4
\$\begingroup\$

The Shakespeare Programming Language, 219 bytes

I am using drsam94's compiler.

.
Ajax,.
Puck,.
Act I:
Scene I:
[Enter Ajax and Puck]
Ajax:
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!
[Exeunt]

Explanation

.

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

Ajax,.
Puck,.

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)

Ajax:

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.

\$\endgroup\$
4
\$\begingroup\$

PHP, 27 bytes

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

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

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


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

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

or 13 bytes with

<?=sqpu^AAAA;

But that idea has already been used by primo

\$\endgroup\$
4
\$\begingroup\$

Golfscript, 6 chars

{xy}.*

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

\$\endgroup\$
4
\$\begingroup\$

><>, 7 4 bytes

"nߞ

Try it online!

Explanation

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

05AB1E, 4 bytes

ToRÀ

Try it online!

T        # 10
 o       # 2**x (1024)
  R      # reverse (4201)
   À     # rotate left (2014)
         # implicit output
\$\endgroup\$
2
  • 1
    \$\begingroup\$ Boring alternative: ŽGMR. \$\endgroup\$ Nov 19, 2019 at 15:42
  • \$\begingroup\$ Some more: ŽFÌ;, ŽG_À, ŽΓû¨, ŽlT¦ \$\endgroup\$
    – Makonede
    Mar 16, 2021 at 22:28
4
\$\begingroup\$

Emotinomicon, 14 bytes

😭ߞ😲😨

Try it online!

Explanation:

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

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

\$\endgroup\$
2
  • \$\begingroup\$ Okay, thanks! In your code, do you convert the quote string to a number when it's outputting? \$\endgroup\$
    – MilkyWay90
    May 25, 2019 at 15:05
  • \$\begingroup\$ @MilkyWay90 Emotinomicon pushes the character code of each character in the string. \$\endgroup\$ May 25, 2019 at 15:07
4
\$\begingroup\$

Rockstar, 34 32 bytes

X was up equalizing a word
Say X

Say hello to rockstar! (No I didn't make this one)

Explanation:

This first line:

X was up equalizing a word

Uses Rockstar's Poetic number literals. (As opposed to regular literals, which use numbers).

This means that the length of every word after was indicates the digit in that position. So here we have a 2 length (up), a 10 length (equalizing) a 1 length (a) and a 4 length (word). The length is % 10, so equalizing becomes a 0, and the result is that the variable X has the value 2014.

Then of course we print it with Say

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Save 2 bytes by using X's instead of X was. \$\endgroup\$
    – Shaggy
    Sep 24, 2020 at 14:44
4
\$\begingroup\$

Add++ -i, 13 bytes

L,"j"O"&"OL/*

Try it online!

Caird why no halve built-in you have like 3 fricking built-ins for doing special stuff with doubling but absolutely nothing for halving why do you do this to me?

Explained

L,"j"O"&"OL/*
L,             # start a lambda that's automatically called by the -i flag
  "j"O         #    push the number 106 to the stack - that's the ascii value of j
      "&"O     #    push 38 to the stack - that's the ascii value of &
          L/   #    push the length of the stack (2) and divide 38 by that. This is not a definitive way to consistently divide by 2...it's a miracle the circumstances allowed this. This results in 19
            *  #    and multiply the two items (106 and 19) to get 2014.
\$\endgroup\$
0
4
\$\begingroup\$

05AB1E, 6 bytes

T·žvÍ«

Uses the CP-1252 encoding. Try it online!

Explanation:

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

C, 37 Characters

main(){printf("%d%d",'d'-'P','\xE');}
\$\endgroup\$
1
  • \$\begingroup\$ You could knock off 3 bytes by renaming main to f since we don't require main to be used. \$\endgroup\$
    – MD XF
    May 12, 2017 at 19:51
3
\$\begingroup\$

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]
\$\endgroup\$
4
  • 1
    \$\begingroup\$ That doesn't use ASCII? That's a bit hard. \$\endgroup\$
    – Joe Z.
    Jan 7, 2014 at 2:04
  • \$\begingroup\$ @JoeZ. My program would work just as well if the system used ebcdic. And as you know, a multitude of ebcdic systems use bash. :-) \$\endgroup\$ Jan 7, 2014 at 3:20
  • \$\begingroup\$ Maybe 34 bytes: :;y=$[x=!$?,x+x];echo $y$?$x$[y+y] Try it online! \$\endgroup\$
    – user92894
    Aug 29, 2019 at 20:32
  • \$\begingroup\$ Hmmm, Just 29 bytes: echo $[x=y=!x,y+=y]$?$x$[y+y] Try it online! \$\endgroup\$
    – user92894
    Aug 29, 2019 at 21:04
3
\$\begingroup\$

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))))
\$\endgroup\$
3
\$\begingroup\$

C# - 64 chars

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

pretty printed

class P 
{ 
    static void Main() 
    { 
        System.Console.Write('!' * '>' - ' ');
    } 
}
\$\endgroup\$
4
  • \$\begingroup\$ What if we use class P { static void Main() { System.Console.Write(2014); } } \$\endgroup\$ Jan 7, 2014 at 6:55
  • \$\begingroup\$ @Amit, you can't use numbers in this challenge... \$\endgroup\$
    – shamp00
    Jan 7, 2014 at 9:10
  • 2
    \$\begingroup\$ if an exit code is acceptable class a{static int Main(){return '!'*'>'-' ';}} is just 47 chars. \$\endgroup\$
    – Jodrell
    Jan 7, 2014 at 12:05
  • 1
    \$\begingroup\$ I like this one, my countdown numbers skills sucked so I ended up with ('d' + 'e').ToString() + Math.Ceiling(Math.PI); \$\endgroup\$
    – NibblyPig
    Jan 8, 2014 at 15:02
3
\$\begingroup\$

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

main(){printf("%o",'\xe'*'J');}
\$\endgroup\$
1
  • \$\begingroup\$ Save 3 bytes by shortening main to f, since we don't require main to be used. \$\endgroup\$
    – MD XF
    May 12, 2017 at 19:52
3
\$\begingroup\$

Sclipting, 3 characters (6 bytes)

This outputs the string "2014".

꼣갱꽀
\$\endgroup\$
5
  • \$\begingroup\$ That's not 3 bytes though. \$\endgroup\$
    – daniero
    Jan 23, 2014 at 19:52
  • 1
    \$\begingroup\$ I didn’t say it was. \$\endgroup\$
    – Timwi
    Jan 23, 2014 at 20:02
  • \$\begingroup\$ Well I can see that obviously, but the question actually asks for a byte count. \$\endgroup\$
    – daniero
    Jan 23, 2014 at 20:30
  • \$\begingroup\$ Byte count stands at 12, I believe. \$\endgroup\$
    – cjfaure
    Feb 8, 2014 at 19:34
  • 2
    \$\begingroup\$ No, it’s 6 bytes. \$\endgroup\$
    – Timwi
    Feb 8, 2014 at 20:35
3
\$\begingroup\$

Pure bash 18

Without fork!

echo $[$[$#xd]#bbc]
2014
\$\endgroup\$
2
  • 1
    \$\begingroup\$ How about: printf %x \'— Just 13 characters (15 bytes). \$\endgroup\$
    – user92894
    Aug 30, 2019 at 22:18
  • \$\begingroup\$ @Isaac Awesome! I learn today this printf %d \'A newer seen before! \$\endgroup\$ Aug 31, 2019 at 7:41
3
\$\begingroup\$

Pyth, 4 bytes

C"ߞ

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

\$\endgroup\$
2
  • \$\begingroup\$ 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. \$\endgroup\$
    – Joe Z.
    Jul 8, 2014 at 11:08
  • \$\begingroup\$ @JoeZ. I understand. No worries, the rules make sense. \$\endgroup\$
    – isaacg
    Jul 8, 2014 at 15:50
1 2
3
4 5
11

Not the answer you're looking for? Browse other questions tagged or ask your own question.