74
\$\begingroup\$

Your task is to display the letter "A" alone, without anything else, except any form of trailing newlines if you cannot avoid them, doing so in a program and/or snippet. Code that returns (instead of printing) is allowed.

Both the lowercase and uppercase versions of the letter "A" are acceptable (that is, unicode U+0061 or unicode U+0041. Other character encodings that aren't Unicode are allowed, but either way, the resulting output of your code must be the latin letter "A", and not any lookalikes or homoglyphs)

You must not use any of the below characters in your code, regardless of the character encoding that you pick:

  • "A", whether uppercase or lowercase.

  • "U", whether lowercase or uppercase.

  • X, whether uppercase or lowercase.

  • +

  • &

  • #

  • 0

  • 1

  • 4

  • 5

  • 6

  • 7

  • 9

Cheating, loopholes, etc, are not allowed.

Since this is , the shortest solution, in bytes, that follows all the rules, is the winner.


Validity Checker

This Stack Snippet checks to make sure your code doesn't use the restricted characters. It might not work properly for some character encodings.

var t = prompt("Input your code.");

if (/[AaUuXx+&#0145679]/.test(t)) {
  alert("Contains a disallowed character!");
} else {
  alert("No disallowed characters");
}

This Stack Snippet that makes sure you don't have a disallowed character is also available on JSFiddle.

Leaderboard

var QUESTION_ID=90349,OVERRIDE_USER=58717;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\$
  • 7
    \$\begingroup\$ @ColdGolf You seem to be saying "yes" to functions, but functions don't display, they usually return. \$\endgroup\$ – xnor Aug 19 '16 at 23:06
  • 2
    \$\begingroup\$ Is ending up with a variable that contains just a also good enough ? \$\endgroup\$ – Ton Hospel Aug 19 '16 at 23:17
  • 1
    \$\begingroup\$ That's not what I meant. The supposed code doing a variable assignment would not contain any of the forbidden characters. I'm just trying to understand what is covered by "display by means other than printing". If "return from a function" is OK, what about "assign to a variable" ? \$\endgroup\$ – Ton Hospel Aug 20 '16 at 0:05
  • 1
    \$\begingroup\$ Why those particular characters? \$\endgroup\$ – user253751 Aug 22 '16 at 1:32
  • 7
    \$\begingroup\$ @immibis A for obvious reasons. U for Unicode escape strings (\u0041 is A), X for hex escape strings (\x41), + for Unicode ordinals (U+0041), & for HTML entities, # for I actually don't know, 65 is the decimal ordinal of A, 41 is the hex ordinal of A, 97 is the decimal ordinal of a, and 0 for a few of the previous reasons. \$\endgroup\$ – Mego Aug 22 '16 at 6:26

183 Answers 183

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

JavaScript ES6 ES5, 23 17 12

12 bytes

`${!3}`[3-2]

17 bytes: (typeof!3)[2- -3]

23 bytes: _=()=>(typeof!3)[2- -3]

Edit 05/10/2016: Took advantage of templating strings, as well as boolean coercion and string/array indexing... Also realized my previous code used +, I could always salvage 2+3 as 2- -3 at a cost of 2 bytes for each previous example... (Updated code and scores for previous submissions)

Edit 30/08/2016:

I took a different approach, exploiting the fat arrow functions as well as the typeof return type, which is a string. So converting a number to a boolean was easier then, had to encase it in parentheses before pulling the 5th element of the resulting string...

Seems that there was no mention of my answer requiring to be in the form of a function, so I've just stripped the fat arrow function declaration.

| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

Vim, 6 bytes

grNg??

Challenge doesn't block N, and Vim has a ROT-13 feature. FDinoff's answer is probably cooler, but this is ASCII and works everywhere.

| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

Vim, 19 bytes (not competing)

:redi@"|Ni!<CR>pJd3w~D

Do you demand a shrubbery?

| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

Piet, 30 codels

I'm sure that this can be improved, but I'm a bit of a Piet newbie.

piet

Side note: I have titled it Icy Toll Gate to a Nether Portal. It's artistic, but not abstract, so it kind of follows the main design principle!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Following community consensus on the meta, piet is now scored by the byte count of the image. You can try to compress it as much as possible provided there is a piet interpreter which accepts it. \$\endgroup\$ – Pavel Jan 1 '17 at 22:39
3
\$\begingroup\$

C++14, 30 bytes

As unnamed lambda (allowed in Python):

[](decltype('B')*c){*c='C'-2;} //'c'-2 for lowercase

//Usage:
#include <iostream>
main(){
  char c;
  [](decltype('B')*c){*c='C'-2;}(&c);
  std::cout << c << std::endl;
}

33 bytes

Function that assigns to its parameter:

int f(decltype('B')*c){*c='C'-2;}

//Usage:

#include <iostream>
main(){
 char c;
 f(&c);
 std::cout << c << std::endl;
}

Pretty hard to do it otherwise since no #include, return or auto because of U. Modifying parameters for return values seems ok Meta

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ You could just use the same printf code as in your C solution inside the lambda and get rid of the argument to make it shorter. \$\endgroup\$ – Alexander Revo Aug 20 '16 at 21:20
3
\$\begingroup\$

SMBF, 4 bytes

<-.B

Try it Online!

Explanation:

<-    Wrap pointer around to the "B" and decrement it, giving "A"
  .   Print
   B  Data storage
| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

TI-Basic, 14 Bytes

:ClrHome
:Disp "Ans
:Output(1,2,"  

Note the two trialing spaces at the end of line 3.

  • TI-Basic has its own character encoding where many commands are 1 or 2-byte tokens. For example, ClrHome is a single byte. Ans is a single byte, so it does not violate the challenge rules.

Cheat version, 3 bytes

:"a

In this code, use the a from the statistic menu: VARS > 5 > Right Arrow > Right Arrow > 2.

| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

Octave, 13 11 8 bytes

Didn't expect to golf this answer down, but wohoo, a bug(?) in Octave made it possible to save two bytes! :) Converting this to a "full program", instead of a function saves an additional three bytes, leaving us with 8 bytes:

['',833]

['',833] concatenates the empty string with the number 883. The ASCII code for A is 65, so 883 might seem a bit odd. I think this must be a bug, but what Octave does when concatenating an empty string and a number is that it takes the number modulus 256. mod(883, 256) == 65 which just so happens to be the ASCII code for A.

Octave does not do this when using the "proper" method, char(883), in which case we will get:

warning: range error for conversion to character value

| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

JavaScript, 21

Capital A because there seems to be no other solution to find a capital A

_=>`${[].keys()}`[8]

`${[].keys}` => "[object Array Iterator]" 8th index is A

_=>`${keys}`[38]

Also works in browser for similar reasons.

Edited to add function

| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

!@#$%^&*()_+, 3 bytes

`^@

Try it online! Outputs lowercase.

Shortest for A seems to be 5 bytes: >^^^@ or B_^_@.

Explanation

`^@
`     push the character "`"
 ^    increment (to `a`)
  @   output as character
| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

Keg, 3 2 bytes

B;

This pushes the ASCII character B onto the stack, and then decrements the value by 1. The value will automatically be printed.

| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

International Phonetic Esoteric Language, 8 bytes

My original answer used the old instruction set and interpreter, which have since been completely rewritten. Still abusing Unicode, and somehow the same length heh.

"C"ʁ2zχo

Explanation:

"C"ʁ     (push "C", convert str to num 67) ( -- 67)
    2    (push 2) ( -- 67 2)
     z   (subtract) ( -- 65)
      χ  (convert num to str) ( -- "A")
       o (print) ( -- )

International Phonetic Esoteric Language, 8 bytes (WIP language) (OLD)

2<C>ʀdχo

The wonders of abusing Unicode as your instruction set.

No TIO interpreter yet, but is runnable by cloning the repository above, and calling python main.py "code here".

2<C>ʀdχo
2        ; push 2
 <C>     ; push "C"
    ʀ    ; pop, push ord("C")
     d   ; pop, push 67 - 2
      χ  ; pop, push chr(65)
       o ; pop, print string
| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

MATL, 5 Bytes

'b'qc

Try it online!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ It's annoying that this requires the c, but unfortunately that behavior is a MATLAB/Octave thing. \$\endgroup\$ – Suever Aug 19 '16 at 22:20
2
\$\begingroup\$

SQF, 30 15

Using the function-as-a-file format:

toString[88-23]

Call as: call FUNCTION

Finally a challenge where SQF can compete. Not win, but actually competing is nice.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Pyth - 3 bytes

Alternate longer answer.

.HT

Try it online here.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ @ColdGolf accept the first one. \$\endgroup\$ – Maltysen Aug 20 '16 at 21:17
  • \$\begingroup\$ also mine is 3 bytes so it can't win. \$\endgroup\$ – Maltysen Aug 20 '16 at 21:18
2
\$\begingroup\$

Snowman, 14 bytes

{8vn2nPNiNwRsp

Explanation

{               # activate bdg
 8              # set b to 8
  vn            # no-op
    2           # set d to 2
     nP         # set b to 8^2=64
       NiN      # set b to b+1 = 65
          wR    # wrap in array
            sp  # print

Try it online

| improve this answer | |
\$\endgroup\$
  • 2
    \$\begingroup\$ ......You rang? \$\endgroup\$ – user18932 Aug 23 '16 at 15:24
2
\$\begingroup\$

Jellyfish, 5 bytes

P;>'@

Try it online!

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Befunge-98, 6 bytes

'Lb-,q

Very basic: 'Lb- pushes (76-11 aka 65), , prints, q quits because using @ is too boring.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Caker, 24 bytes

ωΩθΩθθθθθΩθΘ

Body must be at least 30 characters; you entered 29.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Perl 6, 14 bytes

print 'B'.pred

pred is short for "predecessor"

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

WolframAlpha, 10 bytes

chr(88-23)
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Do you mean "Wolfram Language"? \$\endgroup\$ – Buffer Over Read Aug 21 '16 at 3:30
  • \$\begingroup\$ @ColdGolf WA is a program using Wolfram language. It can also be called from Mathematica by typing equality sign twice (==). Check the link. \$\endgroup\$ – Anastasiya-Romanova 秀 Aug 21 '16 at 3:35
  • \$\begingroup\$ Are you implying I can't use WA? \$\endgroup\$ – Anastasiya-Romanova 秀 Aug 21 '16 at 3:38
  • \$\begingroup\$ Nope, it was just an interesting thing. \$\endgroup\$ – Buffer Over Read Aug 21 '16 at 3:42
2
\$\begingroup\$

3var, 14 11 8 bytes

iii       # set A to 3
   s      # square A to 9
    d     # decrease A to 8
     s    # square A to 64
      i   # increment A to 65
       P  # print A as ascii

Try it online

Saved 3 bytes thanks to Joffan.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Is there a reason to involve R and B - why not iiisdsiP? \$\endgroup\$ – Joffan Aug 21 '16 at 3:21
  • \$\begingroup\$ @Joffan: You are of course correct. There's no reason at all to use R. Thanks! \$\endgroup\$ – Emigna Aug 21 '16 at 9:21
2
\$\begingroup\$

Oracle SQL 11.2, 56 50 bytes

Shorter way to compute 65, thanks to the previous answers using it.

SELECT NVL(MIN('.'),CHR(88-23))FROM col WHERE 2=3;

Old version :

SELECT NVL(MIN('.'),CHR(3*3*8-2-2-3))FROM col WHERE 2=3;

Ugly, but I had to find a way around DUAL

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

PHP, 15 14 bytes

(PHP7 only) Longer than others but a tricky approach :

<?=([].b)[.2];

[] instance an Array

.b cast to string = 'Array' and add any character (here b) at the end (thank you Business Cat)

[.2] : = [0] take first letter (A)

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ This is PHP 7 only, right? \$\endgroup\$ – manatwork Aug 22 '16 at 7:32
  • \$\begingroup\$ You're right PHP7 only, I'll edit \$\endgroup\$ – Crypto Aug 22 '16 at 9:37
  • 2
    \$\begingroup\$ I can't fully test it since I don't have PHP7, but I think you can replace '' with some letter that is legal to use like b. If you do [].b it will concatenate Array with the string b giving Arrayb. \$\endgroup\$ – Business Cat Aug 22 '16 at 12:45
  • \$\begingroup\$ Thank you ! You're right. You can test it with any PHP online interpreter. (Errors and Warning can be ignored) \$\endgroup\$ – Crypto Aug 23 '16 at 5:36
2
\$\begingroup\$

Whitespace, 15 bytes

It's easy to avoid characters with a language that doesn't use any of them!

Try it online!

.               
.   
.  

The .'s are unneccessary, and are just to make the codeblock work.

For a more readable format: s = space, t = tab, newline placement matters

ssstssssst
t
ss

First line pushes (ss) positive (s) 65 (tssssst, binary 1000001) onto the stack)

Second and third lines print top of stack as char.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Verbosy, 13 bytes

~` /3 ^3 \3 o

Verbosy is actually a language I wrote (see the link). Hopefully that's allowed...

Explanation:

~`: set Current to the ` character.

/3: put the ` character into slot 3

^3: increment the character in slot 3 by 1

\3: put the character in slot 3 into Current

o: prints Current

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

R, 12 bytes

I was losing it until I realized I can use 2 and 3.

 LETTERS[3-2]
| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Straw, 6 bytes (non-competing)

Bæ}Æ>

Take the codepoint of B (), get the tail of the string (unary decrement) (}), take the character associated with the codepoint (Æ), and print it (>)

Try it online

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

QBasic, 17 bytes

PRINT CHR$(88-23)

Exploits the fact that the function which converts an integer to char is named CHR.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

PowerShell, 89 59 32 Bytes:

[Convert]::ToString((8-3)*2,8*2)

$d=2-2;[char][byte]"".insert($d,(3*3)-(2*2)).insert($d,2*3) $b=[string]::Concat(2*3);$c=[string]::Concat((3*3)-(2*2));[char][byte]$b.insert(2*2-3,$c)

edit: use of a I see no way around this(not a golf language) It is possible...

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ This is now fixed \$\endgroup\$ – Chad Baxter Oct 8 '16 at 17:47
1 2
3
4 5
7

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