619
\$\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
4 5
6
7 8
11
2
\$\begingroup\$

Python, 52 49 chars

from math import*
print(int((e*pi+e)**pi+e/e+e))

Works in Python 2 and Python 3.

\$\endgroup\$
2
\$\begingroup\$

Labyrinth, 12 bytes

))!!)!))))!@

Try it online!

))))_#!!#!!@

Try it online!

))_#"
 ) !!@

Try it online!

))!"
)
)#!!@

Try it online!

I tried both linear and complex layouts, but I can't figure out how to remove a single byte from any of these programs.

\$\endgroup\$
1
2
\$\begingroup\$

Straw, 13 bytes

(…………………σ)«$>

« sum the codepoint of all characters in a string, $ convert from unary to decimal and > is the print operator.

Try it online

\$\endgroup\$
2
\$\begingroup\$

Hexagony, 18 bytes

g{A*'-"'-'"Av<@!}/
   g { A
  * ' - "
 ' - ' " A
  v < @ !
   } / .

I had trouble getting it to fit in 19 bytes (side length 3) because I was always 1 short, then I rearranged my memory accessing to be 1 shorter, which also allowed me to use a very efficient layout. Then I was able to shift a no-op somewhere in the code to the very end saving a byte.

Try it online!

\$\endgroup\$
2
\$\begingroup\$

Husk, 4 bytes

c'ߞ

Try it online!

\$\endgroup\$
2
\$\begingroup\$

MAWP, 16 bytes

!!M:!!A:!:!!M!M:
chr:pos:stack
! : 1 : [1,1]
! : 2 : [1,1,1]
M : 3 : [1,2]
: : 4 : [1]
! : 5 : [1,1]
! : 6 : [1,1,1]
A : 7 : [1,0]
: : 8 : [1]
! : 9 : [1,1]
: : 10 : [1]
! : 11 : [1,1]
! : 12 : [1,1,1]
M : 13 : [1,2]
! : 14 : [1,2,2]
M : 15 : [1,4]
: : 16 : [1]

Try it!

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Ayy, somebody actually uses my language :D \$\endgroup\$
    – Dion
    Aug 6, 2020 at 5:22
  • \$\begingroup\$ I tried using _ in the online interpreter, but for some reason it didn't work. I made a Gtihub issue on it. I'd like to solve some more puzzles, but that operator is causing a bit of a problem. \$\endgroup\$
    – Razetime
    Aug 6, 2020 at 5:24
  • \$\begingroup\$ Ok, will check and fix. Thanks for notifying me! \$\endgroup\$
    – Dion
    Aug 6, 2020 at 5:25
2
\$\begingroup\$

Python 3, 49 bytes

for i in['..','','.','....']:print(len(i),end='')

Python 3, 15 bytes

print(ord('ߞ'))
\$\endgroup\$
2
  • 2
    \$\begingroup\$ Welcome to the site, and creative first answer! You can improve your score by remove the spaces before the [, before the print and before the end: Try it online! \$\endgroup\$ Nov 17, 2020 at 21:54
  • \$\begingroup\$ @cairdcoinheringaahing thanks for notice me! \$\endgroup\$ Nov 17, 2020 at 21:57
2
\$\begingroup\$

Python 3, 16 bytes (15 characters)

print(ord('ߞ'))

Try it online!

Explanation

ord returns the decimal Unicode of a character, and the decimal Unicode of ߞ happens to be 2014.

Python 2?

I tried doing the same thing in Python 2 (print ord('ߞ')), which would be 1 byte less, but this doesn't work. Why? Well, in Python 3, len('ߞ') returns 1, so everything is fine. However, in Python 2, it returns 2. And since ord only takes a string of length 1, Python 2 doesn't really like that: TypeError: ord() expected a character, but string of length 2 found

\$\endgroup\$
2
\$\begingroup\$

Scratch, 82 bytes

when gf clicked
say(join(length of[The year two thousnd])(length of[and   fourteen
\$\endgroup\$
6
  • 1
    \$\begingroup\$ Happy 2021! Scratch solutions make me happy though so take your upvote :P \$\endgroup\$
    – Citty
    Apr 13, 2021 at 13:04
  • \$\begingroup\$ Out of almost 300 answers, I was surprised that nobody had done Scratch yet! \$\endgroup\$
    – Nilster
    Apr 13, 2021 at 13:08
  • \$\begingroup\$ If functions are allowed, you can do 73 bytes: define say(join(length of[The year two thousnd])(length of[and fourteen \$\endgroup\$ Nov 29, 2022 at 13:02
  • \$\begingroup\$ With \n a newline \$\endgroup\$ Nov 29, 2022 at 13:03
  • \$\begingroup\$ @UndoneStudios Scratch's syntax is the bane of my existence! However, I generally prefer full programs over functions, since they can be easily viewed in a project. Also, OP only specifies "programs." Thanks, though! \$\endgroup\$
    – Nilster
    Dec 2, 2022 at 17:19
2
\$\begingroup\$

CSASM v2.4.0.2, 83 bytes

func main:
push "  "
len
print
push ""
len
print
push " "
len
print
push "    "
len
print
ret
end

The only way to push numbers to the stack without using numbers is to create str instances and then get their lengths.

\$\endgroup\$
2
\$\begingroup\$

Alphabetti spaghetti, 15 bytes

aiioaoaioaiiiio

Try it online!

\$\endgroup\$
1
  • 2
    \$\begingroup\$ 11 bytes with iioaoioiiio or iiuuiuiiiio. \$\endgroup\$
    – ovs
    Jul 10, 2021 at 8:16
2
\$\begingroup\$

not sure if others have used this one already :

from any UTF-8 aware shell

  • printf %d \'ߞ
    

13-chars spanning 14-bytes. the following are equivalent forms :

printf %d \'$'\xDF\x9E'
printf %d \'$'\737\636'
\$\endgroup\$
2
\$\begingroup\$

ACCUMULATOR, 2015 28 bytes

-1987 bytes thanks to a near-escape from the Orwellian thought police!

AAAAAAAAAAAAAAAAAAAACMMMMMMO

This is pretty simple:

  • 20 As increment the accumulator: 20
  • C concatenates it to itself: 2020
  • 6 Ms decrement: 2014
  • O outputs

Old version here

\$\endgroup\$
2
\$\begingroup\$

Desmos, 40 26 25 Bytes

b=\ln ee
k=bb
k^kkb-kkb-b

Desmos graph link

Now smaller by a whole 1 more byte! Yaaay...

Version that needs each line to be pasted individually, 24 23 bytes

b=lnee
k=bb
k^kkb-kkb-b
\$\endgroup\$
7
  • \$\begingroup\$ Could you provide a Desmos graph link in order to easily be able to verify your code? Also, you need to provide the byte count of the program in the header of the post. \$\endgroup\$
    – Aiden Chow
    Apr 26, 2023 at 4:54
  • 1
    \$\begingroup\$ You can shorten b=cos(\tau) to b=lne. \$\endgroup\$
    – Aiden Chow
    Apr 26, 2023 at 4:58
  • \$\begingroup\$ For reference, your solution is 40 bytes at the moment. I have taken pretty much the same calculations which you have in your code, but shortened it considerably to 24 bytes: 24 bytes, Try It On Desmos! \$\endgroup\$
    – Aiden Chow
    Apr 26, 2023 at 5:08
  • \$\begingroup\$ It looks like b=lnee doesn't work since there has to be a space between the function and the characters otherwise desmos does... weird stuff and you have to have a backslash before ln ee so that desmos doesn't just see it as 2 undeclared variables. (also, your last line uses the number 2 but that can be swapped out for b) Still, thanks for the help. \$\endgroup\$ Apr 27, 2023 at 14:47
  • \$\begingroup\$ If you paste in one line at a time instead of the whole thing at once (so paste in b=lnee in the first box, k=bbb in the next line, and kkkbb-kbb-b on the next line), then you will see that it works. \$\endgroup\$
    – Aiden Chow
    Apr 27, 2023 at 17:44
2
\$\begingroup\$

Java, 18 bytes

Just for the sake of using hashCode().

"bmgjagr".hashCode() = 2014
"?=".hashCode() = 2014
"zsjpzdq".hashCode() = 2024

In order to find a candidate string, I iterated over all the strings of 7 and less characters in the range ['a', 'z']. It represents a set of 8'353'082'583 strings and thus a good probability that one of them has the required hashCode.

Thanks to anatolyg, using more characters allows a much simpler string : "?=" (ASCII 63 and 61), 63 * 31 + 61 = 2014.

79 bytes full class:

class C{public static void main(String[]a){System.out.print("?=".hashCode());}}

18 bytes lambda:

x->"?=".hashCode()
\$\endgroup\$
3
  • \$\begingroup\$ I thought 2024 was the required output this year. Also I checked your link and I couldn't find how it helps me to shorten ".hashCode()". \$\endgroup\$
    – Achaaab
    Jan 10 at 18:56
  • 1
    \$\begingroup\$ The hashing algorithm is very simple: it's a series of additions and multiplications by 31. No need for brute-forcing. You can use, for example, 2014=63*31+61. \$\endgroup\$
    – anatolyg
    Jan 10 at 19:45
  • \$\begingroup\$ Ok, I got it now, I first wanted to use only a-z characters which make it much more complicated, but "?=" works as well. \$\endgroup\$
    – Achaaab
    Jan 10 at 19:57
2
\$\begingroup\$

Python 3, 54 bytes

n=mp.dps=ord('㤃');print(str(mp.pi)[n-len('year'):n])

Try it online!

How it works

Extracts the year \$2024\$ beginning at the \$14591^{st}\$ digit of \$\pi\$

3.14...27617285830243559830032042024512072872535581195840...

The next 10 years that eventually appear in Pi's decimal expansion!

\$\endgroup\$
1
1
\$\begingroup\$

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.

main(){printf("%i",('C'-'A')*('T'-'A')*('v'-'A'));}

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.

\$\endgroup\$
3
  • \$\begingroup\$ You don't actually need to include stdio.h, most compilers will give a warning but include it for you. \$\endgroup\$
    – Alexia
    Jan 1, 2014 at 21:58
  • \$\begingroup\$ This code yields 7 for me with tcc and 508830 with gcc. clang gives an error: character too large for enclosing character literal type. \$\endgroup\$
    – Alexia
    Jan 1, 2014 at 22:02
  • \$\begingroup\$ @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. \$\endgroup\$
    – Johannes
    Jan 1, 2014 at 22:58
1
\$\begingroup\$

Solution 1

Octave/Matlab (55 chars)

a=pi;b=a*a;disp(ceil(a^a^a/a/a/a-b*b*a-a^a*b+b*b-b-b));

Solution 2

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

<!--Comment
  previous
  2013 lines -->
<?=__LINE__; <!-- This should be on line 2014 -->
\$\endgroup\$
5
  • \$\begingroup\$ That would be 2013 newlines followed by <?=__LINE__ for 2024 chars, not 9. \$\endgroup\$ Jan 2, 2014 at 9:28
  • \$\begingroup\$ @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 <?=__LINE__;?>, which I thought would be funny :) Nvm, I'll edit that. \$\endgroup\$
    – Vereos
    Jan 2, 2014 at 9:31
  • \$\begingroup\$ If it doesn't work without the newlines, they're part of the "actual code". \$\endgroup\$ Jan 2, 2014 at 9:32
  • \$\begingroup\$ I guess you're right, edited. \$\endgroup\$
    – Vereos
    Jan 2, 2014 at 9:37
  • 1
    \$\begingroup\$ In PHP, you can skip ?> at end of the program. But interesting idea with __LINE__, even if it's ridiculous for such huge number. \$\endgroup\$ Jan 2, 2014 at 12:15
1
\$\begingroup\$

Game Maker Language, 22

show_message(ord("ߞ"))
\$\endgroup\$
1
\$\begingroup\$

C - 44 characters (85 with headers)

What, no one is abusing strings yet?

#include<stdio.h>
#include<netinet/in.h>
main(){printf("%u",ntohs(*(int*)"\a\xde"));}

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:

#include<stdio.h>
#include<netinet/in.h>
int main(){return!printf("%u",ntohs(*(int*)"\a\xde"));}
\$\endgroup\$
1
\$\begingroup\$

C/C++ 39

main(){printf("%d%d",':'-'&',':'-',');}

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

\$\endgroup\$
1
\$\begingroup\$

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

\$\endgroup\$
1
\$\begingroup\$

JavaScript, 49 Chars

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

(m=Math).pow(e=m.E,e*(p=~~m.PI))/m.sqrt(p)+e+e|""

... mmmm PIE.

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

alert((m=Math).pow(e=m.E,e*(p=~~m.PI))/m.sqrt(p)+e+e|"")
\$\endgroup\$
1
\$\begingroup\$

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

C++ - 63 bytes

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

#include<iostream>
int main(){std::cout<<int('&'*(','+'\t'));}
\$\endgroup\$
10
  • \$\begingroup\$ You can use int instead of toascii for all of those to save a lot of characters. \$\endgroup\$
    – Joe Z.
    Jan 7, 2014 at 2:58
  • \$\begingroup\$ @JoeZ. OK, I didn't think of that. How can I calculate the bytes? \$\endgroup\$
    – user10766
    Jan 7, 2014 at 2:59
  • \$\begingroup\$ Save your program as a text file, and then view how many bytes it is in the file manager. \$\endgroup\$
    – Joe Z.
    Jan 7, 2014 at 3:00
  • \$\begingroup\$ 2 is not allowed. \$\endgroup\$ Jan 7, 2014 at 7:46
  • \$\begingroup\$ Oops, I'll fix that. \$\endgroup\$
    – user10766
    Jan 7, 2014 at 16:08
1
\$\begingroup\$

Ruby 1.9, 10 bytes 

p 'ߞ'.ord
\$\endgroup\$
3
  • \$\begingroup\$ nice! 7 chars if you are in the irb command prompt 'ߞ'.ord \$\endgroup\$ Jan 8, 2014 at 16:54
  • \$\begingroup\$ @EduardFlorinescu Thanks, I know. \$\endgroup\$
    – Timtech
    Jan 8, 2014 at 21:38
  • \$\begingroup\$ These are 8 bytes in UTF8. \$\endgroup\$
    – schmijos
    Jul 24, 2017 at 14:42
1
\$\begingroup\$

vba (immediate window), 38 26 13

using regular ascii characters (no funny typing needed)

?&ha+&ha&&&he

26

?val("&hfbc")/-(true+true)

38

?year((cdbl(asc("ê"))*cdbl(asc("²"))))

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

\$\endgroup\$
5
  • \$\begingroup\$ 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. \$\endgroup\$
    – manatwork
    Jan 7, 2014 at 16:08
  • \$\begingroup\$ 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 \$\endgroup\$
    – SeanC
    Jan 7, 2014 at 16:31
  • \$\begingroup\$ 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. \$\endgroup\$
    – manatwork
    Jan 7, 2014 at 16:41
  • \$\begingroup\$ ok.. I was thinking back to DOS days - now it's 0234 and 0178, but I found another shorter way now \$\endgroup\$
    – SeanC
    Jan 7, 2014 at 16:44
  • \$\begingroup\$ Thanks, it works this way. Although here appears “ȩ” and “¸”, the calculation is correct. \$\endgroup\$
    – manatwork
    Jan 7, 2014 at 16:59
1
\$\begingroup\$

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

\$\endgroup\$
1
\$\begingroup\$

Python, 23

print ord("<DC3>")*ord("j")

<DC3> should be replaced with ASCII symbol 19 (device control 3).

\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
1
4 5
6
7 8
11

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