88
\$\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\$
10
  • 7
    \$\begingroup\$ @ColdGolf You seem to be saying "yes" to functions, but functions don't display, they usually return. \$\endgroup\$
    – xnor
    Commented Aug 19, 2016 at 23:06
  • 2
    \$\begingroup\$ Is ending up with a variable that contains just a also good enough ? \$\endgroup\$
    – Ton Hospel
    Commented Aug 19, 2016 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
    Commented Aug 20, 2016 at 0:05
  • 1
    \$\begingroup\$ Why those particular characters? \$\endgroup\$ Commented Aug 22, 2016 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\$
    – user45941
    Commented Aug 22, 2016 at 6:26

229 Answers 229

1
4 5
6
7 8
1
\$\begingroup\$

SmileBASIC, 10 bytes

?KEY(2)[2]

KEY accesses the function buttons used in the editor. They can be set to any string, but by default they are 1:FILES 2:LOAD" 3:SAVE" 4:LIST ERR\r 5:RUN

\$\endgroup\$
3
  • \$\begingroup\$ It's scored in bvtes, not characters. \$\endgroup\$ Commented Jan 24, 2017 at 13:10
  • \$\begingroup\$ Relying on user defaults might not be a good idea, but this is clever. \$\endgroup\$
    – snail_
    Commented Jan 24, 2017 at 16:26
  • \$\begingroup\$ Luckily all the function keys are reset when restarting SB, so this will always print A if it's the first thing you run. \$\endgroup\$
    – 12Me21
    Commented Jan 24, 2017 at 16:32
1
\$\begingroup\$

,,,, 6 bytes

'Co2-c

Explanation

'Co2-c

'C      push "C"                    ["C"]
  o     convert to ASCII ordinal    [67]
   2-   subtract 2                  [65]
     c  convert to ASCII character  ["A"]
        implicit output             []
\$\endgroup\$
1
\$\begingroup\$

K (oK), 8 bytes

Solution:

`c$88-23

Try it online!

Explanation:

Interpretted right-to-left:

   88-23 / 88 minus 23 is 65
`c$      / cast to character ("A")
\$\endgroup\$
1
\$\begingroup\$

Pyth, 3 2 bytes

-1 from Dave reminding me to actually read the docs

hG

Explanation:

hG      The first entry in G (the alphabet)

Try it online!

\$\endgroup\$
6
  • \$\begingroup\$ hG is one byte shorter \$\endgroup\$
    – Dave
    Commented Aug 24, 2017 at 13:10
  • \$\begingroup\$ longer but cuter is Ch^^2 2 3 \$\endgroup\$
    – Dave
    Commented Aug 24, 2017 at 13:14
  • \$\begingroup\$ @Dave Really? Didn't know that's how that worked \$\endgroup\$
    – Stan Strum
    Commented Aug 24, 2017 at 16:07
  • \$\begingroup\$ h of a sequence returns the first value \$\endgroup\$
    – Dave
    Commented Aug 24, 2017 at 16:11
  • 1
    \$\begingroup\$ @Dave I should really head back to my desktop. This phone keyboard is so problematic. \$\endgroup\$
    – Stan Strum
    Commented Aug 24, 2017 at 16:17
1
\$\begingroup\$

Python, 31 bytes

print(chr(-~(2**(8-2))),end='')

Explanation: 8-2 is 6, and 2**6 (2 to the power of 6) is 64. chr(65) is A, so I need to add 1 without using + (or 1). I then used -~ which adds 1, creating chr(65) which is A.

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

Ahead, 6 bytes

'C2-o@

'C      push 67 (C in unicode)
  2     push 2
   -    subtract
    o   print char
     @  end

Try it online!

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

Scratch, 38 bytes

when gf clicked
think(letter(2)of<[]<[

Try it online!

think is used instead of say because say has an a.

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

MathGolf, 3 2 bytes

-1 byte thanks to maxb

╩Z

Try it online!

Fetches the 90th word in the dictionary, which is a uppercase 'A'.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ You can shave a byte off using ♂¢ \$\endgroup\$
    – maxb
    Commented Dec 6, 2018 at 8:03
  • \$\begingroup\$ For lowercase you have ╩♦ \$\endgroup\$
    – maxb
    Commented Dec 6, 2018 at 8:07
  • \$\begingroup\$ There's also ╩Z for the uppercase. Check out the MathGolf chat, I have a great tool coming up for challenges like this one. \$\endgroup\$
    – maxb
    Commented Dec 6, 2018 at 8:14
1
\$\begingroup\$

MathGolf, 2 bytes

♂¢

Try it online.

Explanation:

♂     # Push 10
 ¢    # Convert to hexadecimal (and output implicitly)
\$\endgroup\$
1
\$\begingroup\$

Brian & Chuck, 7 bytes

B?
!<-.

Try it online!

code:

Brian:
B    constant B
?    switch to Chuck

Chuck:
<    go to B
-    decrement it
.    and print it
\$\endgroup\$
1
\$\begingroup\$

Brain-Flak, 28 bytes

(((((()()()()){}){}){}){}())

Try it online!

code:

(((((()()()()){}){}){}){}()) push 65
                             implicitly print stack
\$\endgroup\$
1
\$\begingroup\$

Julia 1.0, 12 bytes

print('d'-3)

Try it online!

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

W d, 2 bytes

∑Ƿ

Explanation

Pretty much boils down to this after decompression:

'A
\$\endgroup\$
1
\$\begingroup\$

Pip, 4 bytes

/O@z

Try it online!

Explanation

   z  Lowercase alphabet
  @   First character
 O    Output without newline
/     Invert

That last (first?) instruction requires some more explanation:

By default, Pip prints the last expression in the program with a trailing newline. (This is why we couldn't do @z for 2 bytes, since the challenge states that newlines should be avoided if at all possible.) That's a problem because O@z, in addition to outputting a without a newline, is also an expression that evaluates to a. So O@z by itself would print aa plus a newline.

There are two ways to get rid of the extra output: First, we could output inside an if statement (5 bytes: IzO@z or other similar programs). Second, we could make the final expression in the program evaluate to nil. Nil produces no output when printed, not even the trailing newline. The usual way to suppress auto-printing is to end the program with u, a variable preset to nil. Unfortunately, u is banned. We could use the nil expression (), which would put us back at 5 bytes: O@z().

Enter the unary division operator /, which inverts its operand. In this case, if we invert O@z, the operand is the string a. Non-numeric strings evaluate to 0 in numeric contexts, which means we're dividing by 0. This gives nil, which suppresses the newline exactly as desired.

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

Wren, 41 bytes

System.write(String.fromCodePoint(88-23))

Try it online!

\$\endgroup\$
2
  • 1
    \$\begingroup\$ You're not allowed to use characters 6 and 5 :/ \$\endgroup\$
    – daniero
    Commented Dec 26, 2019 at 22:00
  • \$\begingroup\$ 6 and 5 are disallowed because the asker knew someone would try this lol \$\endgroup\$ Commented Dec 27, 2019 at 1:15
1
\$\begingroup\$

Wenyan, 39 33 bytes (WIP language)

加陰以『』夫其之二書之

Update: Wenyan now supports 『』 in place of 「「」」 for quoting strings. (starting from v0.1.2)

Literally console.log((false+"")[2-1]) but not using any of +, a and 1

Explanation

         書之          // console.log(               )
     夫其之             //             (        )[ -1]
 陰                   //              false
加 以                  //                   +
   『』                //                    ""
        二            //                        2

Note: Indexing in Wenyan is 1-based.

\$\endgroup\$
4
  • \$\begingroup\$ What might make this non-competing? \$\endgroup\$ Commented Dec 31, 2019 at 16:19
  • \$\begingroup\$ @pppery For being a language invented in December 2019. I have heard that such restriction is removed, but the challenge was posted in 2016 so I doubt whether the change is applicable here. \$\endgroup\$ Commented Jan 2, 2020 at 4:50
  • 1
    \$\begingroup\$ That rules change does in fact apply to challenges that predate it. \$\endgroup\$ Commented Jan 2, 2020 at 12:33
  • \$\begingroup\$ But 加陰以""夫其之2書之 is only 27 bytes. \$\endgroup\$
    – tsh
    Commented Jun 12, 2020 at 2:43
1
\$\begingroup\$

Ruby, 16 bytes

$><<[*??..?B][2]

Get's the third element in the range from '?' to 'B', which is 'A'!

Explanation

$><<[*??..?B][2]

    [*      ]     create an array containing the elements from
        ..        the inclusive range from
      ??          literal '?' character to
          ?B      literal 'B' character
                  this array is now ['?', '@', 'A', 'B']
             [2]  get the 3rd element of this array ('A')
  <<              append/write that to
$>                standard output


Try it online!

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

Google Sheets/Excel (15 bytes)

Assuming your localization is in English:

=MID(2=3,2,2/2)

Note: this will not work on LibreOffice because it will change FALSE to 0 instead of "FALSE".

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

MAWP, 5 bytes

88WM;

Creates ASCII code for \$8*8+1(existing)=65\$ and outputs it.

Try it!

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

Nim, 12 bytes

echo'B'.pred

Try it online!

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

Knight, 10 9 bytes

O G F T T

Try it online!

# print...
OUTPUT(
   # extract a substring
   # Specifically, the "a" from "false"
   GET(
     FALSE # coerces to "false"
     TRUE # 1
     TRUE # 1
   )
)
  • 1 byte to a massive dum moment, thanks MarcMush
\$\endgroup\$
2
  • 1
    \$\begingroup\$ O G F T T seems to work too \$\endgroup\$
    – MarcMush
    Commented Jun 18, 2021 at 14:02
  • \$\begingroup\$ Lmao I'm dumb.... \$\endgroup\$
    – EasyasPi
    Commented Jun 18, 2021 at 14:02
1
\$\begingroup\$

PICO-8, 16 bytes

?chr(ord("c")-2)

Moves back from C to get to A.

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

HTML5, 99 48 47 bytes

<p id=e><script>e.innerHTML=` ${!2}`[2]</script

Apparently you don't need the > after </script to parse correctly

(old versions)

<p id=e><script>e.innerHTML=` ${!2}`[2]</script>
<p id=e><script>this[`doc${[!!2].join``[2]}ment`].getElementById`e`.innerHTML=` ${!2}`[2]</script>

Try it below:

<p id=e><script>e.innerHTML=` ${!2}`[2]</script

Deobfuscated (new version):

<!DOCTYPE html>
<html>
<head></head>
<body></body>
  <p id="paragraphID"></p>
  <script>
    // in JavaScript, when paired with HTML, any element with an id implicitly has the element with the id stored as a global variable, so you don't need to call document.getElementById or document.querySelector
    paragraphID.innerHTML = ' false'[2]; // JS is 0 indexed, so ' false'[2] is 'a' (there's a space before 'false')
  </script>
<html> 

Deobfuscated (old version):

<!DOCTYPE html>
<html>
<head></head>
<body></body>
  <p id="paragraphID"></p>
  <script>
    document.getElementById("paragraphID").innerHTML = ' false'[2]; // JS is 0 indexed, so ' false'[2] is 'a' (there's a space before 'false')
  </script>
<html> 
[!!2].join``[2]

is [true].join("") is true.toString() is "true", and the 2nd index of "true" is u

` ${!2}`[2]

This is " false" index 2, which with the space at the beginning is a (inspired by slebetman)

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

Kustom, 33 bytes

$tc(reg,tc(type,أ),".....$","")$

explained:

$tc(reg,      regex replace
  tc(type,أ),  text type of some Arabic character (="ARABIC")
  ".....$",   replace 5 characters at the end...
  ""          ... with the empty string
)$
\$\endgroup\$
1
\$\begingroup\$

J, 14 10 8 6 bytes

hfd-!3

Attempt This Online!

-2 thanks to south, with another 4 on a variation of south's idea

-2 thanks to Bubbler and south, taking that idea one step further

We take the hex representation of -6.

\$\endgroup\$
7
  • 1
    \$\begingroup\$ I found 12! I am unsure if anything shorter is possible, but there's likely more 12's to find. \$\endgroup\$
    – south
    Commented Dec 11, 2022 at 23:06
  • \$\begingroup\$ You can get rid of the ] for 11 with {.{:3!:3%:3 too. Both yours and mine are snippets, though, which is no longer allowed. I'll go ahead and update anyway since the problem is old. \$\endgroup\$
    – Jonah
    Commented Dec 11, 2022 at 23:30
  • \$\begingroup\$ @south Using a variant of your idea got it down to 10. \$\endgroup\$
    – Jonah
    Commented Dec 11, 2022 at 23:36
  • 1
    \$\begingroup\$ Here's 7, hfd-3*2. \$\endgroup\$
    – south
    Commented Dec 12, 2022 at 1:58
  • 2
    \$\begingroup\$ 6 (variation of south's): hfd-!3. Another fun 7: hfd?.23 (?.23 deterministically returns 10) \$\endgroup\$
    – Bubbler
    Commented Dec 12, 2022 at 2:12
1
\$\begingroup\$

Aheui (esotope), 18 bytes

밣따밯타맣희

Try it online!

This answer "cheats" by choosing a language where the entirety of ASCII (other than newline) is meaningless, but constructing a number is hard (the only constants you can push directly are 0 and 2-9, and -1 on EOF). At least 65 is simpler to construct than 97.

A straightforward program that prints charcode 65 would be 7 chars (21 bytes): 밣발다발따맣희, or in pseudo-assembly:

push 8; push 5; add; push 5; mul // pushes 65
putchar; halt

But the program at the top uses a specific behavior of arithmetic operators that, if there are not enough operands, the next direction is reversed. So 밣따 (push 8; mul) at start runs like this:

push 8 // [8]
mul // fails; go back to `push 8`
push 8 // [8, 8]
mul // [64], proceeds to the next command on its right

Then the remaining instructions are:

밯    getchar // push -1 instead because EOF
타    sub     // adds 1 to 64 to get 65
맣희  putchar; halt
\$\endgroup\$
1
\$\begingroup\$

(,), 56 Chars or \$56\times \log_{256}(3)\approx\$ 11.09 Bytes

((),()()()()()()()()()()()()())(,,,(())(())(())(())(()))
\$\endgroup\$
1
\$\begingroup\$

Google Sheets, 25 bytes

=LEFT(SORT(RITZCODERZ()))
\$\endgroup\$
1
\$\begingroup\$

YASEPL, 13 12 bytes

=m$8^=d-:m›

:3

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

Kotlin, 7 bytes

{'C'-2}

Try it!

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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