g | x | w | all
Bytes Lang Time Link
nanPxem240621T033727Z鳴神裁四点一号
058PHP240620T172523Zint 21h
009Uiua231022T054847Zchunes
110Rust231022T130855Zleo848
007Thunno 2230713T173754ZThe Thon
2017x8616 machine code221011T124753Z640KB
045Arturo221109T182929Zchunes
nan221225T102827ZRARE Kpo
026POSIX Shell Command Language + Utilities221122T190125Zнабиячлэ
048Julia221007T181538ZAshlin H
018k221116T095952Zcillianr
016><>221109T074855ZEmigna
012Pyth221008T061218Zu-ndefin
061Excel ms365221007T121629ZJvdV
041Elixir221011T093205ZKirill L
028Ruby nl221011T075858ZKirill L
043C#221010T074153ZAcer
137C++ gcc221009T183211Zhuanglx
041Knight v2221009T190731ZnaffetS
nanFig221009T185529ZnaffetS
019Thon221007T121722ZThe Thon
029J221009T161353Zhuanglx
067Rust221009T123414Zcorvus_1
041Python221007T213136ZJonathan
015Jelly221008T192645Zsporkl
031Raku221008T154858ZSean
013K ngn/k221008T135334Zcoltim
050Red221008T100250Zchunes
061C clang221007T120038Zpavi2410
048JavaScript ES6221007T121715ZArnauld
062Red221008T075422ZGalen Iv
009Pyth221008T061223Zhakr14
025Ly221008T055413Zcnamejj
029Factor221007T114427ZRazetime
021Retina 0.8.2221007T125356ZNeil
024Perl 5 plF221007T210015ZXcali
042sed221007T193726ZJiří
038R221007T184800Zpajonk
064brainfuck221007T183018Zm90
034Juby221007T181151ZJordan
015BQN221007T155926ZDominic
037Ruby221007T125340ZJordan
510Nibbles221007T125310ZDominic
039PowerShell221007T153845Zuser3141
018Pyth221007T125750ZManish K
01105AB1E221007T121926ZKevin Cr
013Charcoal221007T125808ZNeil
012MathGolf221007T124941ZKevin Cr
044Python221007T124509Zloopy wa
066simply 0.11221007T122726ZIsmael M
008Vyxal221007T113922Zlyxal
050Python 3221007T112709ZThe Thon
009Japt221007T112000ZShaggy
013APL Dyalog Extended221007T111715ZAdá

Pxem, 0 + 45 = 45 bytes

Filename, with non ascii byte. For example \5 is U+0005.

\5.t.w.i1.-a.+.m\1.-.t.m.a.cj.x.s.vA.v.cj.a.v.p

Try it online!

How it works

\5.t        register = 5
.w          while pop() != 0
  .i          push getchar() # eof is -1
  1.-a.+      push(97+abs(pop()-49))
  .m\1.-.t    register -= 1
  .m          push register
.a          endwhile
.cj.x       while top > 106
  .s          drop
  .vA.v       insert 65 to bottom of stack
.cj.a       endwhile
.v.p        putchar() from bottom to top

PHP, 58 bytes

fn($x)=>strtr(sprintf("%05d",$x),1234567890,"abcdefghiA");

Attempt This Online!

The solution is based on the characters translation. sprintf fills the string with the trailing zeroes which are get translated to "A" while the digits 123456789 are converted to abcdefghi.

Uiua, 11 10 9 bytes

⬚@A↙¯5+@`

Try it!

 ⬚@A↙¯5+@`
       +@`  # add backtick character
 ⬚@A↙¯5     # take the last five characters, filling any excess with A

Rust, 110 bytes

Takes the number and returns the converted string in the aaaaa way.

|x:u64|"A".repeat((4-x.ilog(10))as _)+&x.to_string().bytes().fold(format!(""),|mut s,b|{s.push((48+b)as _);s})

Attempt This Online!

Rust, 93 bytes

Returns a byte slice, i.e. Vec<u8> instead that corresponds to the ASCII-encoded aaaaa string.

|x:u64|{let mut v=vec![65;(4-x.ilog(10))as _];v.extend(x.to_string().bytes().map(|b|48+b));v}

Attempt This Online!

Thunno 2, 7 bytes

ÄLJ'A5ṙ

Try it online!

Explanation

ÄLJ'A5ṙ  '# Implicit input
Ä         # Number to alphabet
 L        # Lowercase each
  J       # Join into a string
   'A    '# Using "A" as a filler,
     5ṙ   # pad the string to length 5
          # Implicit output

x86-16 machine code, 20 17 bytes

00000000: fcb8 4141 abab fd03 f14e ac04 30aa e2fa  ..AA.....N..0...
00000010: c3 

Callable function, custom calling convention. Input string at DS:[SI], CX = input string length (1-5), output string buffer at ES:[DI].

Listing:

FC          CLD                 ; string direction forward
B8 4141     MOV AX, 'AA'        ; AL and AH = pad char
AB          STOSW               ; pad only first 4 chars
AB          STOSW 
FD          STD                 ; string direction reverse
03 F1       ADD  SI, CX         ; SI = end of input string
4E          DEC  SI             ; SI = last char of input
    A_LOOP:
AC          LODSB               ; load next char
04 30       ADD  AL, 'a'-'1'    ; aaaaaa convert
AA          STOSB               ; write to output
E2 FA       LOOP A_LOOP
C3          RET                 ; return to caller

Test program output:

enter image description here

Props: -3 bytes thx to @l4m2!

Arturo, 62 45 bytes

$[s][pad.with:`A`join map s=>[to :char 96+]5]

Try it

ultra verbose awk solution:

echo '43213
8645
342
99991' | 
awk '$!NF=sprintf("%c%c%c%c%c",___+(__+$(_=($(_<_)=sprintf("%.*d%s",5-NF,
         _=_<_,$_))^_))^!!$_,___+(__+$++_)^!!$_,(__+$++_)^!!$_+___,
        ___+(__+$++_)^!!$_,___+(__+$++_)^!!$_)' __=32 ___=64 FS=
dcbac
Ahfde
AAcdb
iiiia

POSIX Shell Command Language + Utilities, 26 bytes

printf %05d $1|tr 0-9 Aa-i

Self-explanatory: printf renders the argument padded to five columns with zeroes, then tr does the transformation per spec.

Transcript of test cases:

$ cat a.sh; echo; wc -c a.sh
printf %05d $1|tr 0-9 Aa-i
26 a.sh
$ ./a.sh 8645; echo
Ahfde
$ ./a.sh 43213; echo
dcbac
$ ./a.sh 8645; echo
Ahfde
$ ./a.sh 342; echo
AAcdb
$ ./a.sh 99991; echo
iiiia

Julia, 48 bytes

~x=replace(lpad(x,5,'A'),('1':'9'.=>'a':'i')...)

Attempt This Online!

Julia 1.0, 67 65 bytes

~x=getindex.([Dict(0:9 .=>['A';'a':'i'])],[0;0;0;0;x][end-4:end])

Try it online!

-2 bytes thanks to @MarcMush: replace [[0,0,0,0];x] with [0;0;0;0;x]

k, 18 bytes

"A"^-5$10h$96+10\:

><>, 17 16 bytes

r5l6=.a7+!
68*+o

Try it online

Explanation

r        !    # reverse stack on first iteration
 5l6=.        # if stack length is 5, move to next row
      a7+     # else add 17 to stack
68*+o         # add 48 to each item on stack and print as char

Pyth, 14 13 12 bytes

@L+\AG+mZ-5l

Try it online!

Explanation:

@L+\AG+mZ-5l # whole program

             # implicit output
 L           # left map with lambda d:
@            # using index
  +          #  concatenate
   \A        #   literal "A"
     G       #   and literal "abc...xyz"
      +      # into a concatenation of:
       mZ    #  a constructed list of n zeroes
             #   where n is: (the 2nd argument for m is supplied an int)
         -5  #    the difference of 5
           l #    and the length of implicit input (Q)
             #  and the implicit input (Q)

Excel (ms365), 63 61 bytes

-2 Thanks to @EngineerToast for 61 bytes:

=RIGHT(CONCAT("AAAA",CHAR(96+MID(A1,SEQUENCE(LEN(A1)),1))),5)

Or, the original answer for 63 bytes:

=CONCAT(MID("Aabcdefghi",MID(TEXT(A1,"00000"),ROW(1:5),1)+1,1))

enter image description here


Note that it can probably be done with less bytes if input is an array of numbers but thought I'd take a single integer as startpoint.

Elixir, 41 bytes

&for<<x<-String.rjust(&1,5,17)>>,do: x+48

Try it online!

Ruby -nl, 28 bytes

p$_.rjust(5).tr" 1-9","Aa-i"

Attempt This Online!

C#, 43 bytes

x=>x.PadLeft(5,'').Select(y=>(char)(y+48))

represents the character with code 17; 48 is added to this to produce A.

Try it online!

C++ (gcc), 142 138 137 bytes

-4 thanks to @ceilingcat.

First time golfing in C++, there are probably many places where improvements could be made. #include <bits/stdc++.h> was really expensive in terms of bytes.

#include<bits/stdc++.h>
int f(int n){for(int i=5;i--;){putchar(((n%(int)exp10(i+1))/(int)exp10(i))?(n%(int)exp10(i+1))/exp10(i)+96:65);}}

Try it online!

Takes integer inputs and outputs as string.

Knight (v2), 41 bytes

;=iP;=s*'A'5;Wi;=s+sA+96[i=i]iO Gs-Ls 5 5

Try it online!

Fig, \$14\log_{256}(96)\approx\$ 11.524 bytes

$t5$J*/A5OC+96

Try it online!

Thon, 19 bytes

n"Aabcdefghi"b5"A"J

Input as a number (e.g. 824). Output as a string (e.g. AAhbd).

Explanation

n"Aabcdefghi"b5"A"J
n                    // Input a number
 "Aabcdefghi"        // Push the string of letters
             b       // Convert the number to Base-"Aabcdefghi" (see below)
              5"A"J  // Fill with "A" up to 5 characters
                     // (implicit output)

Converting to base-"Aabcdefghi" is a trick to replace every "1" with "a", every "2" with "b", etc.

Thon (Symbols), 16 bytes

(Note: this language is newer than the challenge)

)ş{í1-å`;}""]5AṚ

Explanation

)ş{í1-å`;}""]5AṚ
)                 // Create an empty list
 ş                // Get input as a string
  {      }        // For each character in the input:
   í              //   Convert to an integer
    1-            //   Subtract 1
      å`          //   Push the lowercase alphabet and get the character
        ;         //   Append to the list
          ""]     // Join the list by an empty string
             5AṚ  // Fill the string with "A" up to 5 characters
                  // (implicit output)

J, 29 bytes

There probably is a shorter way (perhaps with a.) than a hard-coded string mapping, but everything I tried ended up being longer.

'Aabcdefghi'{~],~[:0"0[:i.5-#

Try it online!

Takes input as array of numbers and outputs a string.

Rust, 67 bytes

|a|format!("{:A>5}",a.map(|d|char::from(d+96)).collect::<String>())

Try it online!

Python,  42  41 bytes

-1 thanks to loopy walt's suggestion to use XOR, ^, instead of addition.

lambda a:[chr(96^d)for d in[33]*5+a][-5:]

An unnamed function that accepts a list of integers from \$[1,9]\$ and returns a list of characters.

Try it online!

Jelly, 15 bytes

DịØa;@”Ax5¤Uḣ5U

Try it online!

Almost certainly I'm missing some atoms or syntax tricks that can get this down further. 11 bytes are spent to handle the padding.

Explanation:

DịØa;@”Ax5¤Uḣ5U
D               get decimal representation
 ịØa            index into lowercase alphabet
      ”Ax5¤     repeat "A" 5 times
    ;@          prepend "A"s to the other string
           Uḣ5U take the last 5 characters

Raku, 31 bytes

{TR/0..9/Aa..i/}o*.fmt('%05d')

Try it online!

*.fmt('%05d') is an anonymous function that formats its integer argument to five digits, padded on the left with zeroes. { TR/0..9/Aa..i/ } is a second anonymous function that transliterates its string argument, turning 0 into A and 1-9 into a-i. The o operator composes those two functions.

K (ngn/k), 13 bytes

"A"^-5$`c$96+

Try it online!

Red, 50 bytes

func[v][insert/dup v 17 5 take/last/part v + 48 5]

Try it online!

Takes input as a vector of code points and returns output as the same.

C (clang), 69 67 63 61 bytes

f(x,o,i)char*o;{for(memset(o,65,i=5);x;x/=10)o[--i]=x%10+96;}

Try it online!

JavaScript (ES6), 48 bytes

Expects an integer and returns a string.

f=(n,k=5)=>k?f(n/10|0,k-1)+"Aabcdefghi"[n%10]:''

Try it online!


C (gcc), 48 bytes

k;f(n){k++>4?k=0:f(n/10)|putchar(n?n%10+96:65);}

Try it online!

47 bytes

This version was suggested by @jdt.

i;f(*o,x){for(i=5;i;x/=10)o[--i]=x?96+x%10:65;}

Try it online!

Red, 62 bytes

func[s][forall s[s/1: #"`"+ s/1]pad/left/with rejoin s 5 #"A"]

Try it online!

Pyth, 9 bytes

.[\A5m@Gt

Test suite

This answer uses a sufficiently different approach from the existing Pyth answer(s).

Explanation:
.[\A5m@Gt   | Full code
.[\A5m@GtdQ | with implicit variables
------------+----------------------------------------------------
     m    Q | Replace each number d in the input with
      @G    |  the character of the lowercase alphabet with index
        td  |  d minus 1
.[\A5       | Pad the array on the left with A to a length of 5

Ly, 25 bytes

iry5L[f5f-['Ao,]]pp['0+o]

Try it online!

Pretty straight forward reading of the rules...

ir                        - read the digits in a codepoints, reverse stack
  y5                      - push digit count, push "5"
    L                     - check: digitCount<5
     [          ]pp       - exec block if digit count < 5
      f5f-                - subtract digit count from 5, get pad count
          [   ,]          - loop once for each pad digit...
           'Ao            - print "A"
                   [    ] - loop or all the codepoints on the stack
                    '0+   - convert from 0-9 to a-i
                       o  - print as character

Factor, 29 bytes

[ >dec 48 v+n 5 65 pad-head ]

Attempt This Online!

-6 from chunes.

Retina 0.8.2, 21 bytes

T`d`_l
^
AAAA
!`.{5}$

Try it online! Link includes test cases. Explanation:

T`d`_l

Translate digits to lowercase letters.

^
AAAA

Prefix four As.

!`.{5}$

Take the last 5 letters.

A port of @Jiří's sed answer is also 21 bytes:

T`d`_l
+`^.{0,4}$
A$&

Try it online! Link includes test cases.

Perl 5 -plF, 24 bytes

$_=A x(5-@F).y/1-9/a-i/r

Try it online!

sed, 42 bytes

y/123456789/abcdefghi/
:a
s/^.{,4}$/A&/
ta

Attempt This Online!

R, 38 bytes

\(d)intToUtf8(tail(c(!1:5,d+31),5)+65)

Attempt This Online!

Takes input as a vector of digits, outputs a string.

brainfuck, 64 bytes

>>>>>+>,[>,]<<<<<<-[---[----<+>]<++.>>-]>[<-[----->+<]>---.[-]>]

Try it online!

Explanation

>>>>>+>

Move to position 5, make the value there 1, and move to position 6.

,[>,]

Read the digits into consecutive positions from there onward.

<<<<<<

Move 6 positions to the left. From here, each 0 before the 1 in position 5 indicates an A to be output.

-[---[----<+>]<++.>>-]

Subtract 1. Loop while it's not 0 (thus was not 1):

>[<-[----->+<]>---.[-]>]

Move right. Loop while it's not 0 (over all the digits):

J-uby, 34 bytes

I think I’m finally starting to get the hang of J-uby. A few bytes shorter than my Ruby answer.

:*&(:+&96|:chr)|:join|~:rjust&?A&5

Attempt This Online!

BQN, 17 15 bytes

Edit: -2 bytes thanks to Razetime

¯5↑"AAAA"∾+⟜'`'

Try it at BQN REPL

          +⟜'`'     # add each element of input to the '`' character
         ∾          # join this to 
   "AAAA"           # "AAAA" (shorter than (5⥊'A'))
_5↑                 # take -5 elements
                    # (which takes 5 elements from the end)

Ruby, 37 bytes

-3 bytes thanks to Dingus

->a{a.map{''<<_1+96}.join.rjust 5,?A}

Attempt This Online!

Nibbles, 5 bytes (10 nibbles)

&"A"5+'`'
     +     # add each element of input
      '`'  # to '`' character
&          # then justify the text
 "A"       # using the "A" character
    5      # to a width of 5           

enter image description here

PowerShell, 39 bytes

-join($args|%{[char](96+$_)})|% *ft 5 A

Try it online!

Takes integers as unnamed arguments. Nothing fancy, just adds 96 to get to the ASCII code of 'a', casts to a char, joins the chars to a string, then pipes the string to % (an alias for ForEach-Object), which will call the string's member "PadLeft". Output is implicit.

Pyth, 18 bytes

V-5lzp"A")Vzp@GtsN

Try it online!

Explanation

V-5lzp"A")Vzp@GtsN
V                   # For loop with N as variable
    z               # Input
   l                # Length
 -5lz               # Subtract length of input from 5
     p"A"           # Prints "A"
         )          # End of for loop
            p       # Print without any additional newline
              G     # Initialized to "abcdefghijklmnopqrstuvwxyz"
                sN  # Cast N to an integer
               t    # Subtract 1
             @      # Get element at index

05AB1E, 11 bytes

₃+>çΔ'Aš5.£

Input as a list of digits; output as a list of characters.
(If the inputs would have been 0-based (digits 0-9 mapping to a-j) instead of 1-based, the > could have been dropped.)

Try it online or verify all test cases.

Or alternatively:

5j9LðšA¬uì‡

Both input and output as a string.

Try it online or verify all test cases.

Explanation:

Unfortunately 05AB1E lacks a left-pad up to length builtin (unless by spaces), so most of the bytes are to account for that in the first program..

₃+>          # Add 96 to each value
   ç         # Convert each from a codepoint-integer to a character
    Δ        # Loop until the result no longer changes:
     'Aš    '#  Prepend an "A"
        5.£  #  Leave (up to) the last 5 characters from the list
             # (after which the result is output implicitly)
5j           # Left-pad the (implicit) input-string with spaces up to length 5
  9L         # Push list [1,2,3,4,5,6,7,8,9]
    ðš       # Prepend a space: [" ",1,2,3,4,5,6,7,8,9]
  A          # Push the lowercase alphabet: "abcdefghijklmnopqrstuvwxyz"
   ¬         # Push its first character (without popping): "a"
    u        # Uppercase it: "A"
     ì       # Prepend it: "Aabcdefghijklmnopqrstuvwxyz"
      ‡      # Transliterate the space-padded input from [" ",1,2,3,4,5,6,7,8,9] to
             # "Aabcdefghij..."
             # (after which the result is output implicitly)

Charcoal, 13 bytes

✂⁺×⁴A⭆S§β⊖ι±⁵

Try it online! Link is to verbose version of code. Explanation:

    A           Literal string `A`
  ×             Repeated
   ⁴            Literal integer `4`
 ⁺              Concatenated to
      S         Input as a string
     ⭆          Map over digits
        β       Predefined variable lowercase alphabet
       §        Indexed by
          ι     Current digit
         ⊖      Decremented
✂               Sliced from
            ⁵   Literal integer `5`
           ±    Negated

MathGolf, 12 bytes

(h5,'A*\É▄\§

Input as a list of digits; output as string.

Try it online.

Or alternatively:

▄▒\(§y♫α'A═╡

Input as a list of digits; output as a string wrapped inside a list.

Try it online.

Explanation:

(        # Decrease each digit in the (implicit) input-list by 1
         # (because MathGolf uses 0-based indexing)
 h       # Push the length of the list (without popping)
  5,     # Calculate 5-length
    'A* '# Repeat "A" that many times
 \       # Swap so the list as at the top again
  É      # For-each over the digits, using 3 characters as inner code-block:
   ▄     #  Push the lowercase alphabet
    \    #  Swap so the current digit is at the top
     §   #  Index the digit into the alphabet
         # (after which the entire stack joined together is output implicitly as result)
▄        # Push the lowercase alphabet
 ▒       # Convert it to a list of characters
  \      # Swap so the (implicit) input-list is at the top
   (     # Decrease each digit by 1 (because MathGolf uses 0-based indexing)
    §    # Index each digit in the list into the alphabet list
     y   # Join it back together again
♫        # Push 10000
 α       # Pair it with the earlier string
  'A═   '# Pad both to an equal length by left-padding with "A"
     ╡   # Remove the last item from the pair (the 10000)
         # (after which the entire stack joined together is output implicitly as result)

Python, 44 bytes

lambda s:f"{s:05}".translate("bcdefghiAa"*9)

Attempt This Online!

Takes an integer and returns a string.

simply 0.11, 66 bytes

This abuses bugs in the parser, to save bytes.
It works with the commit 98783927a8a232b8e0afb46f380e02348b0f7cbb - current commit at the time.
The behaviour will, VERY LIKELY, change in the future.

Creates an anonymous function that receives an array of numbers, and outputs the value.

fn($L){if$l=&len($L)<5for$_ in$l..4out'A'each$L as$i;out!ABCL[$i]}

Example of usage:

This should output "AAfcf".

$fn = fn($L){if$l=&len($L)<5for$_ in$l..4out'A'each$L as$i;out!ABCL[$i]}
call $fn([5,2,5]);

How it works?

It simply checks the length of the array, and if it is lower than 5, it outputs 1 to 5 'A's.

It goes from 0 to 4 because it uses a range operator.
Going from 4 to 4, is just 1 iteration - the number 4 itself.
Going from 0 to 4, is 5 iterations - the number 0, number 1, number 2, number 3 and number 4.

Then, it uses the pre-existing constant !ABCL, which contains the letters from a to z, in lowercase.
The values in the array are used as indexes into the constant.

Ungolfed

Very code-y looking:

$fn = fn($list) => {
    $len = &len($list);
    if $len < 5 then {
        for $_ in $len..4 {
            echo 'A';
        }
    }
    
    foreach $list as $index {
        echo !ABCL[$index];
    }
};

Pseudo-code looking:

Set $fn to an anonymous function($list)
Begin.
    Set $len to the result of calling &len($list).
    In case $len < 5 then
    Begin.
        Loop from $len to 4 as $_
        Begin.
            Show the value 'A'.
        End.
    End.
    
    Loop through $list as $index
    Begin.
        Show the contents of !ABCL[$index].
    End.
End.

All versions do the exact same.

Vyxal, 8 bytes

øA∑\A5ø↳

Try it Online!

Finally, a use for some of the more niche string digraphs. Takes input as a list of digits, outputs a single string.

Explained

øA∑\A5ø↳
øA        # Get the nth letter of the alphabet for each digit in the input
  ∑       # Join as a single string
   \A     # Push the string "A" to the stack
     5    # Push the number 5 to the stack
      ø↳  # And left pad the single string from early with "A"s until it's 5 characters long 

Python 3, 50 bytes

lambda l:''.join(chr(96+i)for i in l).rjust(5,'A')

Takes a list of integers as input

Try it online!

Japt, 9 bytes

Takes input as a string.

c+48 ù'A5

Try it

c+48 ù'A5     :Implicit input of string
c+48          :Map charcodes, adding 48 to each
     ù'A5     :Left pad with "A" to length 5

APL (Dyalog Extended), 13 bytes

Full program prompting for digit number list

'A'@=¯5↑⎕⊇⌊⎕A

Try it online!

⎕A uppercase Alphabet

Lowercase that

⎕⊇ use the input to select from that (1-indexed)

¯5↑ take the last 5 elements of that, adding padding elements on the left

'A' put "A"s where equal to the padding element