75
\$\begingroup\$

Challenge:

The concept is simple enough: write a full program to output its own code golf score!

Output should only be the byte count of your program and a trailing bytes.

BUT WAIT..... there is one restriction:

  • Your source code can not include any of the digits from your byte count
  • So if your score is 186 bytes, your program can not contain the characters 1 , 6 , or 8

Example Output:

315 bytes
27 Bytes
49 BYTES

Additional Rules:

  • Unnecessary characters, spaces, and newlines are forbidden in the source code, however trailing spaces and newlines are perfectly acceptable in output
  • There should be a single space between the number and bytes in the output
  • Letters are case insensitive
  • No self inspection or reading the source code
  • standard loopholes are disallowed

  • this is , so

Shortest code in bytes wins!

\$\endgroup\$
15
  • 7
    \$\begingroup\$ Does this need the quine tag, or may the code self-inspect? \$\endgroup\$
    – Adám
    Mar 29, 2018 at 15:59
  • 3
    \$\begingroup\$ @Dat, given the formatting of the word bytes I suspect the intention is that the count should include the bytes it takes to print the text: bytes \$\endgroup\$ Mar 29, 2018 at 16:16
  • 2
    \$\begingroup\$ Are leading spaces in output acceptable? \$\endgroup\$
    – rafa11111
    Mar 29, 2018 at 17:43
  • 5
    \$\begingroup\$ If my code is 1 byte long, should I output 1 bytes or 1 byte? (keep in mind there are already 41 answers, although I don't think any are affected) \$\endgroup\$ Mar 29, 2018 at 18:07
  • 2
    \$\begingroup\$ Can bytes be in any case pattern, e.g. bYtEs? \$\endgroup\$ Dec 27, 2019 at 14:56

191 Answers 191

1
3 4 5 6
7
0
\$\begingroup\$

Go, 46 Bytes

package main;func main(){print(38+8," bytes")}
\$\endgroup\$
1
  • 3
    \$\begingroup\$ Yeah, but now you have no space between the number and the bytes \$\endgroup\$
    – Jo King
    Sep 27, 2018 at 14:40
0
\$\begingroup\$

C (gcc), 32 bytes

main(){printf("%d bytes",8*4);}

Nothing crazy here.

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

Commodore 64 - 74 tokenized and BASIC bytes

Assuming by score in bytes, you mean tokens and bytes used by the BASIC interpreter, this works:

0 def fn b(x) = 38911-(fre(x)-2^16*(fre(x)<x)): print fnb(.);"bytes

There is a bug in the FRE() function on the Commodore 64 as it assumes maximum size of BASIC is 32K, or 32768 bytes.

Commodore VIC-20 (unexpanded) - 29 tonkenized and BASIC bytes

0?(60*60-17)-fre(.)"bytes
\$\endgroup\$
0
\$\begingroup\$

Zsh, 16 bytes

<<<$[##␐]\ bytes

Attempt This Online!

should be a literal 0x10 byte, but that doesn't show up in SE markdown.


Zsh -BCDEFGHIJ, 13 bytes

<<<$#-\ bytes

Attempt This Online!

Cheating.

\$\endgroup\$
3
  • \$\begingroup\$ What is that flag lol \$\endgroup\$ Aug 24, 2022 at 15:14
  • 2
    \$\begingroup\$ @thejonymyster It doesn't matter what the contents of the flag is, but the code itself is counting the length of the flags (I think). \$\endgroup\$
    – naffetS
    Aug 24, 2022 at 16:14
  • \$\begingroup\$ @Steffan That's correct. Note that Zsh already has the options 569X enabled by default, so by adding BCDEFGHIJ the length of the options reaches 13. \$\endgroup\$
    – pxeger
    Aug 24, 2022 at 17:33
0
\$\begingroup\$

Thunno, 14 bytes

7 2*J" bytes"+

Attempt This Online!

Explanation

7 2*             # Push 7 * 2 (14)
    J            # Convert to string
     " bytes"    # Push the string " bytes"
             +   # Concatenate
                 # Implicit output
\$\endgroup\$
0
\$\begingroup\$

Malbolge, 106 bytes

D'`_ML"n<YkFEVwwe@PsON;:ml[kG4ECe#z@x,_^)\[Zvotm3qSi/gfed*hgfH%]baZ_^W{UZSRWVUNrR4PINGLEiIBG@dDCB$@?>=<5YF

Try it online!

Created with zb3 malbolge tools

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

05AB1E, 15 bytes

30 2/ò" bytes"J

Try it online!

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

TypeScript's type system, 24 bytes

type F=`${0o30} bytes`;;

Try it at the TS playground

TIL TypeScript has octal literal types. Two dead bytes because 0o26 has a 2 in it.

TypeScript's type system, 65 55 bytes

type Z=[1,1,1,1,1]["length"]
type F=`${Z}${Z} bytes`;;;

Try it at the TS playground

3 dead bytes there, in order to get both digits the same.

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

Pascal, 48 Bytes

Pascal according to ISO standard 10206 “Extended Pascal” allows you to specify integer literals up to a base of 36.

program p(output);begin write(7#66,' Bytes')end.
program p(output);begin write(9#53,' Bytes')end.

See also the FreePascal submission.

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

YASEPL, 16 bytes

=a$**^~>" bytes"

ibe, 28 bytes

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

J-uby, 28 bytes

I know more succinct solutions are possible but this one amused me.

:join&:succ*[?1,?7," byter"]

Attempt This Online!

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

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.