51
\$\begingroup\$

Challenge

Print the following characters:

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890

The catch is that you may not use any one of them in your code.

You may print them in arbitrary order, with or without a leading or trailing newline, but you may not print any other characters.

Rules

  • You may not use any characters from the set mentioned above
  • You may use any other characters
  • No cheating
  • Standard loopholes banned
  • This is , shortest answer wins.

Clarifications

  • If your language uses a different charset, you may not use codepoints in that charset that correspond to alphanumeric characters.
  • Returning a string from a function is considered a valid form of output.
  • You may return a char array.
\$\endgroup\$
  • 8
    \$\begingroup\$ This is somewhat ambiguous. If you mean output those raw bytes without those bytes in your code, then you should specify that you can't use the codepoints of these characters, even if they map to something else in your language's codepage. \$\endgroup\$ – FlipTack Jan 5 '17 at 19:57
  • 11
    \$\begingroup\$ So this means that I cannot use any letters or numbers in my source code. Well, that pretty much takes out any non-esoteric languages. \$\endgroup\$ – R. Kap Jan 5 '17 at 20:04
  • 2
    \$\begingroup\$ What if the language is just raw bytes (as opcodes) that don't have a representation? Am I free to use any characters? \$\endgroup\$ – FlipTack Jan 5 '17 at 22:03
  • 1
    \$\begingroup\$ @briantist it's fine if they're internally represented by ints, but the characters themselves have to be printed. \$\endgroup\$ – dkudriavtsev Jan 5 '17 at 23:15
  • 3
    \$\begingroup\$ @R.Kap Javascript could work, provided you don't think of it as eso \$\endgroup\$ – Destructible Lemon Jan 5 '17 at 23:32

43 Answers 43

2
\$\begingroup\$

JavaScript, 371 bytes

(ÿ=(À=!($={})+(ø=""))[ò=ì=+[]],ý=(Þ=!ò+ø)[++ì],ó=(Ó=$+ø)[ì],Ú=$.$+ø,ú=Þ[í=ì+ì],é=Þ[î=í+ì],ç=Ó[Ì=î+í],þ=Þ[ò],Î=Ì+í,$=$[Ç=ç+ó+Ú[ì]+À[î]+þ+ý+ú+ç+þ+ó+ý][Ç],$($((È=ý+é+þ+ú+ý+Ú[ì])+`"${ÿ+ó+ý}(_=ò;_<Ì<<Ì;)ø+=${(ß="\\")+ì+í+î+þ+ý+(Ð=(ð=ß+ì)+Ì)+ì+Ç[í]+(æ=ð+í*í+Î)}.${ÿ+ý+ó+Ð+Ì+ð+ò+î+Ð+ò+À[ì]+ý+ð+ò+î+ó+Ú[í]+é}(_++);${È} ø.${ý+é+ð+í*î+ò+À[í]+À[ì]+ç+é}(/${ß+ß+ð+í+Î}|_/${æ},'')"`)()))()

The (...)() scaffolding is only there to make it easier to paste it into the F12 console, and doesn't count toward the total, as per the rules. Output:

"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"

This is based on the same method as the other JavaScript solutions: using string coercion to get at some internal string constants to build a string to get at the constructor of the constructor of an object. A constructor is a function, so its constructor is Function, which allows us to build a new one, essentially like eval.

One difference with previous solutions is that I tried to use more ‘sensible’ variable names, which made it easier to try out new ideas:

ç   c         Ç   constructor        ò   0      ß   \
é   e         Ó   [object Object]    ì   1      ð   \1
ó   o         Ú   undefined          í   2      Ð   \15
þ   t         Þ   true               î   3
ú   u                                Ì   5
                                     Î   7
ÿ   f         À   false 
ý   r         È   return 
æ   \147 = g

The trick that ended up saving the most was to first generate way too much and then filtering out all the characters I didn't need.

\$\endgroup\$
  • 1
    \$\begingroup\$ Does this print with the "s around the text? \$\endgroup\$ – Post Rock Garf Hunter Jan 8 '17 at 1:08
  • \$\begingroup\$ It looks like you're using ISO-8859-1 charset. Am I wrong? Can you clarify? \$\endgroup\$ – Olivier Grégoire Jan 8 '17 at 19:06
2
\$\begingroup\$

MarioLANG, 255 233 199 bytes

+
+
+
+
+
+
+
+
)
><
+"
+
+(
+(
+(
+(
++
+)
)+
++
++
++
+)
++
++
++
++
++
++
++
+)
()
()
-
[!)+)+)-)--)+++((
=#==============
>((+(+      >((+
"======<    "====<
![-)).).((((![-)).
#===========#=====

Try it online!

The more time Mario spends in the air, the less floor you have to draw and the less characters you use for the solution...

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

WSF, 145 bytes

Prtty much a direct translation of Dennis's answer.

Stack Exchange cannot display the code, so here is a reversible xxd hexdump:

00000000: 2020 2020 2020 2020 2020 2020 2020 2020                  
00000010: 0a20 200a 2020 200a 2020 2020 2020 2020  .  .   .        
00000020: 2020 2020 200a 2020 2020 2020 2020 200a       .         .
00000030: 2009 0920 0920 0920 0920 2009 0a09 200a   .. . . .  ... .
00000040: 2020 2020 0a20 200a 0909 2020 0920 2009      .  ...  .  .
00000050: 0a09 200a 200a 0a20 200a 2020 200a 2020  .. . ..  .   .  
00000060: 2020 200a 2020 2020 2020 0920 0920 0920     .      . . . 
00000070: 2009 0a09 200a 2020 2020 0a20 200a 2020   ... .    .  .  
00000080: 0909 200a 2020 0909 0920 0920 2009 0a09  .. .  ... .  ...
00000090: 0a

The interpreter runs it perfectly, producing the following output:

0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz
\$\endgroup\$
1
\$\begingroup\$

Stacked, 70 bytes

(π²²~~:' '#.-):'='#.'#'#.%+..#:'/'#.(πτ/~_:π²~~+|>)+#:++$∪#/!

Leaves a character array on the top of the stack. This simply uses some character and pi magic. Try it here!

\$\endgroup\$
  • \$\begingroup\$ The link doesn't do anything when I paste your code in there... \$\endgroup\$ – Patrick Roberts Jan 7 '17 at 6:51
  • \$\begingroup\$ @PatrickRoberts yeah, because it's a function. Add put to the end to see the result. \$\endgroup\$ – Conor O'Brien Jan 7 '17 at 7:06
  • \$\begingroup\$ Ah, neat okay. I don't know Stacked obviously ^^; \$\endgroup\$ – Patrick Roberts Jan 7 '17 at 7:13
1
\$\begingroup\$

x86 machine code, 30 bytes

Hexdump:

8b d7 8b f9 2b c9 b1 1a b0 7b 2a c1 aa 2c 20 aa
2c 11 3c 3a 7d 01 aa e2 ef 88 0f 8b fa c3

Represented as if it had Windows 1252 encoding, with control characters using the Control Pictures visualization:

‹×‹ù+ɱ␚°{*Áª, ª,␑<:}␁ªâïˆ␏‹úÃ

It's 32-bit code (IA-32) using fastcall calling convention - receives the pointer to output in ecx.

Assembly code:

    mov edx, edi;
    mov edi, ecx;
    sub ecx, ecx;
    mov cl, 26;
myloop:
    mov al, 'a' + 26;
    sub al, cl;
    stosb;
    sub al, 'a' - 'A';
    stosb;
    sub al, 'A' - '0';
    cmp al, '9'+1;
    jge myskip;
    stosb;
myskip:
    loop myloop;
    mov [edi], cl;
    mov edi, edx;
    ret;

Does 26 iterations (cl = 26 down to 1). At each iteration, calculates and outputs a lowercase letter, an uppercase letter and a number. If the number is out of range, doesn't output it.

The output is written to address in ecx, and null-terminated.

The result:

aA0bB1cC2dD3eE4fF5gG6hH7iI8jJ9kKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ

Interesting things about this code:

  • Save-restore of the edi register is usually done by push-pop, but push edi is alphanumeric (W) - so I did it with mov edx, edi and mov edi, edx
  • Zeroing a register is usually done by xor, but to avoid an alphanumeric character, I did it with sub; same byte count
  • jge is one of only a few conditional jump instructions that are allowed
\$\endgroup\$
  • \$\begingroup\$ I don't quite get it. It's definitely not a DOS code (not a single 66 prefix despite 32-bit instructions). Then what's it? A function? Then what calling convention does it follow? \$\endgroup\$ – Ruslan Jan 8 '17 at 16:43
  • \$\begingroup\$ I've clarified my answer \$\endgroup\$ – anatolyg Jan 8 '17 at 16:46
1
\$\begingroup\$

PHP, 339 bytes (no bitwise string)

Of course not the shortest code, but an alternate method using the Array to string cast.

<?=$_=([]._)[-~-~-~-_],++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,$_=([]._)[_],++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,$_=-_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_,++$_;?>

([]._) cast an array to string leading "Array_", then you can take both "A" and "a" and use increment string method.

-~-~-~-_ is giving "3" using multiple minus bitwise not() (maybe this can be improved)

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

Pyt, 3 bytes

ɬɳǰ

Explanation:

ɬ           Pushes "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
ɳ          Pushes "0123456789"
ǰ         Joins the strings on the stack with no delimiter
Implicit print

Try it online!

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

Befunge-93, 38 33 bytes

"/*@:`:":^
,\~+:" "->!#$_::%$\~-:

Try it online!

Uses a different method than this answer. The first line pushes these six numbers: (47, 10 + 32), (64, 26 + 32), (96, 26 + 32), representing the 0-9, A-Z and a-z ranges respectively (lengths are summed with 32 so that they can all be printable non-alphanumeric characters, as well as 32 itself), as well as an extra number that gets consumed shortly after (can be any truthy value). Then, execution jumps to the second line, which loops to print all of these ranges.

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

Perl 6, 50 bytes

{([~] '/'^..^':')~([~] '@'^..^'[')~[~] '`'^..^'{'}

Block that returns the string since I don't think there's any way to print without using alphanumeric characters.

Try it online!

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

GW-BASIC, 109 bytes

Hex dump of file:

FE 88 A9 C5 C2 1A 0E BF  11 A2 17 7B DC 10 87 D6
B8 8D A1 F3 E2 F3 A3 18  2B 1C E7 A1 14 7D 8D 3E
15 27 0C 2C 0B 2E F9 F1  C0 7D C4 5D 00 F1 89 C4
82 A5 D8 3C C9 CF 17 F0  D7 89 AF 40 8A AE 9D 03
8B EE A4 91 91 2F 5B DE  D5 AA 18 FE B9 AD C8 3A
5D F7 04 1A F2 1A 7C EC  DF 2C DD 88 D3 94 3B 40
7F EB B9 2C 1A B2 F3 C0  8C D3 95 10 1A

As you can see, none of the forbidden characters (30..39, 41..5A, 61..7A) are used. To run, use LOAD"filename.bas and then RUN.

\$\endgroup\$
  • \$\begingroup\$ Could you include the source, even if that includes the restricted bytes? \$\endgroup\$ – MD XF Jun 5 '17 at 3:16
0
\$\begingroup\$

Charcoal, 10 bytes

βα⪫E…⁰χIιω

Try it online!

Explanation

β            Lowercase alphabet (implicitly printed)
 α           Uppercase alphabet (implicitly printed)
  ⪫        ω Join by ""
   E   Iι  Map with cast
     …⁰χ     Range from 0 to 10
\$\endgroup\$
  • \$\begingroup\$ βαFχI﹪⊕ιχ works (9 bytes). might change later \$\endgroup\$ – ASCII-only Nov 4 '18 at 6:35
0
\$\begingroup\$

Stax, 2 bytes

Éè

Run and debug it

This isn't very interesting. Just a built-in constant. I used the packed program encoding to avoid alphanumerics, but normally, this is known as VL.

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

MathGolf, 12 bytes

▄_Äδ☻♥+$♂(Ä└

Try it online!

Explanation

▄              lowercase alphabet as string
 _             duplicate TOS
  Äδ           capitalize each letter and push to the stack
    ☻♥+        push 16+32 = 48
       $       pop(48), push ord(48) = "0"
        ♂(     push 10-1 = 9
          Ä    start block of length 1
           └   push TOS+1 without popping (pushes "1"-"9")
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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