Output your Score!

54

4

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!

X1M4L

Posted 2018-03-29T15:34:07.607

Reputation: 1 586

6Does this need the [tag:quine] tag, or may the code self-inspect? – Adám – 2018-03-29T15:59:46.263

Pardon me for asking, but what is a trailing byte (I'm sorta new ). – Dat – 2018-03-29T16:14:08.617

3@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 – Jeff Schaller – 2018-03-29T16:16:30.050

2Are leading spaces in output acceptable? – rafa11111 – 2018-03-29T17:43:55.807

3If 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) – Erik the Outgolfer – 2018-03-29T18:07:33.183

@X1M4L Also, I don't recommend code to be able to self-inspect, this would easily make a generalized quine challenge if not for that. – Erik the Outgolfer – 2018-03-29T18:11:41.940

Can bytes be uppercase? – Jo King – 2018-03-29T22:44:49.900

1@JoKing well I didn’t address casing in the rules, but if somehow using capital letters makes your score lower, then by all means I’d love to see what you came up with. I say go for it! – X1M4L – 2018-03-29T22:50:34.283

@X1M4L i can imagine that in some programming languages (mostly very ancient ones) there are no lowercase characters in a character set. In this case however, it's just to make Brainfuck code more compact which seems fair. – Konrad Borowski – 2018-03-30T12:44:41.720

Can the output be surrounded by quotes? – Reinstate Monica -- notmaynard – 2018-03-30T13:54:28.360

@iamnotmaynard im sorry but output is limited to numerical byte count, the word bytes, and white-space characters – X1M4L – 2018-03-30T15:51:26.540

As rafa11111 asked earlier: Are leading spaces acceptable? – Stewie Griffin – 2018-04-01T15:31:15.830

@StewieGriffin - I you read the question only trailing whitespaces seems to be allowed. – Cyclonecode – 2018-04-04T08:48:42.373

Can bytes be in any case pattern, e.g. bYtEs? – Hello Goodbye – 2019-12-27T14:56:19.283

@HelloGoodbye sure – X1M4L – 2019-12-31T07:32:25.547

Answers

44

JavaScript, 19 bytes

Octal was invented to serve two purposes:

  • setting file permissions in Linux
  • answering this challenge

alert(023+' bytes')

Try it online!

Arnauld

Posted 2018-03-29T15:34:07.607

Reputation: 111 334

Does this count as a full program? – ericw31415 – 2018-03-29T21:06:09.020

1

@ericw31415 This is a browser program, as defined in this meta answer.

– Arnauld – 2018-03-29T21:13:40.650

6+1 because finally clarifying me why octal is not completely useless! – sergiol – 2018-04-15T11:31:37.647

34

Perl 5, 16 bytes

There are many other ways to get 16 but this one is mine

say afpbytes^PPP

Try it online!

Ton Hospel

Posted 2018-03-29T15:34:07.607

Reputation: 14 114

1How does this work? – caird coinheringaahing – 2018-03-30T13:00:12.480

9@cairdcoinheringaahing In perl you can leave out the quotes on strings if they looks like a literal and don't conflict with a keyword (and is very much deprecated but we don't care in golf), Binary operators & | ^ and ~ can also be applied to strings and work on them like on a list of ASCII values (if and only if *both* sides are strings). For | and ^ it works as if the shorte string is extended with \0. After that is a simple exercise to find combinations of letters that xor to the desired output, – Ton Hospel – 2018-03-30T14:12:54.787

26

7, 23 characters, 9 bytes

54340045141332401057403

Try it online!

This is a fairly hard challenge in a language that consists entirely of digits, but I managed it…

This is just 9 bytes in 7's encoding. (Strictly speaking, it's 8⅜ bytes (23 × ⅜ − ¼ because the final two trailing 1 bits can be omitted), but for the first time, PPCG's requirement to round up to a whole number of bytes is actually an advantage because it means that the extra trailing 1 bits are necessary and thus not banned by the question.) A reversible hex dump:

00000000: b1c0 2530 b6a0 22f8 1f                   ..%0.."..

The main challenge of writing this program in 7 was golfing it to under 10 bytes (as writing 7 without using 0 or 1 is pretty hard.) This uses the same structure as the standard "Hello world" program:

54340045141332401057403
5434004514133240105      commands 0-5 append literals to data space
                   7     start a new section of data space
                    403  another literal appended to data space
                         {implicit: eval the last section as commands}
                    4    swap 1st and 2nd sections with an empty section between
                     6   reconstruct the commands that would create the 1st section
                      3  output (+ some other effects we don't care about)

In other words, we start by creating two sections of the data space; we have two literals, each of which pushes a sequence of commands there. The second section (they're pushed stack-style so first push = last pop) is a fairly arbitrary sequence of commands but is pushed using the command sequence 5434004514133240105 (thus producing the data sequence 5434664574733246765; when discussing 7 in text, I normally use normal font for a command that pushes a literal, and bold for the corresponding resulting literal). The first section is pushed using the command sequence 403, producing 463. Then the first section is copied back to the program (an implicit behaviour of 7).

The 463 is now composed of (bold) commands that do something immediately, rather than (non-bold) commands that just push literals. 4 rearranges the sections to get our "string literal" into the first section. Then 0 does the operation that 7 is most known for: taking a section of data space, and reconstructing the command sequence that's most likely to have created it. In the case where the original command sequence was all 0-5, this is 100% accurate (unsurprisingly, as those commands purely push data and thus leave obvious evidence of what they did), and so we get our original sequence 5434004514133240105 back. Finally, 3 prints it.

So the remaining thing to look at here is the encoding of the string. This has its own domain-specific language:

5434004514133240105
5                    change encoding: 6 bits per character
 43                  select character set: digits and common symbols
   40                '9'
     04              space
       51            select character set: uppercase letters
         4133240105  'B' 'Y' 'T' 'E' 'S'

(There's no "select character set: lowercase letters" in the "digits and common symbols" character set – you have to go via a different character set first – so I needed to use uppercase to golf this short enough to fit underneath the effective 10-byte limit.)

ais523

Posted 2018-03-29T15:34:07.607

Reputation: 11

16

Canvas, 8 bytes

8 bytes+

Try it here!

A more interesting 20 byte solution:

bytecount.innerText#

Try it here!

dzaima

Posted 2018-03-29T15:34:07.607

Reputation: 19 048

3OK, that is pretty clever. – Adám – 2018-03-29T15:58:55.880

Notice that one of the restrictions is "Your source code can not include any of the digits from your byte count" so the first solution is not valid in this case =) – Cyclonecode – 2019-11-04T06:23:30.570

1@Cyclonecode That "8" there isn't a regular ASCII 8 though - it's a full-width 8 character in this unicode version of the code, though really it's the byte 0xD5, which is completely unrelated to any 8s – dzaima – 2019-11-04T06:59:27.363

12

brainfuck, 53 BYTES

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

Try it online!

Another submission with capitalised bytes. Found with the help of the excellent BF-crunch helper by primo.

Jo King

Posted 2018-03-29T15:34:07.607

Reputation: 38 234

11

PHP, 14 bytes

<?=7*2?> bytes

Cyclonecode

Posted 2018-03-29T15:34:07.607

Reputation: 231

8

How about putting the bytes part outside the ?>? Try it online!

– Jo King – 2018-03-30T00:02:41.883

@JoKing great 3 less bytes :) – Cyclonecode – 2018-03-30T01:37:58.703

1Just fyi, it's probably best that you split up your answer into multiple answers if you cover more than one language. – Conor O'Brien – 2018-03-30T16:56:20.073

@ConorO'Brien - Oki will do – Cyclonecode – 2018-03-30T17:10:27.333

8

PHP older than 7.2, 13 bytes

Assumes default settings (E_NOTICE warnings disabled) and PHP version older than 7.2.

Needs to be decoded with xxd -r

00000000: 3c3f 3d7e cecc df9d 868b 9a8c 3b         <?=~........;

Or if you prefer Base64

PD89fs7M352Gi5qMOw==

Try it online!

Konrad Borowski

Posted 2018-03-29T15:34:07.607

Reputation: 11 185

7

R, 16 bytes

cat(4*4,"bytes")

Try it online!

Giuseppe

Posted 2018-03-29T15:34:07.607

Reputation: 21 077

Isn't it 17 because of your missing space? – PmanAce – 2018-03-30T03:05:29.367

@PmanAce "Output should only be the byte count of your program and a trailing bytes". The program is 16 bytes. – Giuseppe – 2018-03-30T03:13:01.397

cat by default adds a space between its inputs. – Giuseppe – 2018-03-30T03:13:32.607

object.size outputs in the correct format (with bytes included by default). Annoyingly, the shortest I could find is 17: object.size(0)-39. TIO – Robin Ryder – 2019-08-02T16:12:44.220

@RobinRyder why is 0 56 bytes? that's the part that confuses me – Giuseppe – 2019-08-02T17:04:44.977

@RobinRyder Hadley's book says a zero-length vector takes up 40 bytes, so that's 40, 8 bytes for a 64-bit number, and 8 more bytes which come from...somewhere.

– Giuseppe – 2019-08-02T17:09:08.310

All the byte counts in that reference are off by 8. On my machine, a zero-length is 48 bytes, not 40. Maybe Hadley's results are outdated? – Robin Ryder – 2019-08-03T08:12:04.773

1Apparently, in Hadley's version, a 1-length vector is of length 48, so there must exist a version of R in which this 16-byte code works: object.size(0)/3. – Robin Ryder – 2019-08-03T08:13:01.317

@RobinRyder there must be! The first edition (which I linked) came out in September 2014 so it's a version 3.1.1 or earlier; the 2nd edition removes that particular section altogether. – Giuseppe – 2019-08-03T14:15:15.017

6

Stax, 5 bytes

╗↑╞ô╝

Run and debug it

Unpacked, it looks like this. Packed source mode makes this kind of trivial and uninteresting.

5p     print 5 with no line break
`5l@   print the compressed string " bytes"

If you don't want to use packed source mode, 6^p`5l@ works for 7 bytes.

recursive

Posted 2018-03-29T15:34:07.607

Reputation: 8 616

1

I've downvoted this answer, because I think that using packed mode, while a clever way of saving bytes, feels like cheating (which it isn't) at worst, and uncreative at best. Rather than go on a downvote spree of all Stax restricted-source answers, I'll leave this downvote to cover all such similar answers.

– caird coinheringaahing – 2018-04-11T19:34:21.340

1I certainly agree that it's uncreative. But I think the fault lies with the concept of restricted-source, not the language. This is actually the most direct way of producing "5 bytes" using Stax. – recursive – 2018-04-11T19:36:31.023

I do agree that there is a problem with the challenge (hence why I've downvoted it), but I still dislike this answer. Please don't delete it though (just preemptive caution), there's nothing wrong with it. – caird coinheringaahing – 2018-04-11T19:39:23.083

5

Python 3, 25 24 18 bytes

print(6*3,'bytes')

Try it online!

NieDzejkob

Posted 2018-03-29T15:34:07.607

Reputation: 4 630

1But "4" is in "24". Maybe "33-9"? – recursive – 2018-03-29T15:44:45.783

@recursive 3*8 should be fine, though – Kevin Cruijssen – 2018-03-29T15:45:12.347

@recursive whoops, fixed it :P – NieDzejkob – 2018-03-29T15:47:30.030

5

05AB1E, 6 bytes

₂¤“ÿ¡Ï

Try it online!


₂      # [26]        | Pushes 26 (many other alternatives).
 ¤     # [2, 6]      | Split out tail.
  “ÿ¡Ï # ['6 bytes'] | ÿ = "Interpolate top of stack.", ¡Ï = "bytes" (compressed)

Alternatives for ₂¤ include: 5>, ₁¤,

Magic Octopus Urn

Posted 2018-03-29T15:34:07.607

Reputation: 19 422

5

Too bad *this* doesn't work.

– Magic Octopus Urn – 2018-03-29T16:19:13.083

5

Bash, 21 bytes

"Read your own source code" is clearly not the winner here, but no one else submitted one, so what the heck.

echo `wc -c<$0` bytes

Try it online!

thegreatemu

Posted 2018-03-29T15:34:07.607

Reputation: 311

5

Retina, 15 bytes


 bytes
*>w`..+

This program counts the number of substrings with at least two characters in the string " bytes", and then prints this count and the string itself.

Try it online!

Leo

Posted 2018-03-29T15:34:07.607

Reputation: 8 482

5

PHP + HTML, 16 bytes

&#49;&#54; bytes

Yes, this is getting pretty close to loophole abuse, but I felt this needed to be posted. And the use of PHP means that this answer technically is written in a Turing-complete programming language. Of course, any other similar HTML templating language would work just as well.

Live demo (without PHP):

&#49;&#54; bytes

Ilmari Karonen

Posted 2018-03-29T15:34:07.607

Reputation: 19 513

Beat me to it! And the ; can usually be omitted! – wedstrom – 2018-04-02T21:53:44.780

Ahh but then it would be 14/15 bytes – wedstrom – 2018-04-02T21:57:24.080

4

Forth (gforth), 14 13 bytes

$d . ." bytes

Try it online!

NieDzejkob

Posted 2018-03-29T15:34:07.607

Reputation: 4 630

4

Java 5 or 6, 44 bytes (full program)

enum A{A;{System.out.print(0x2C+" bytes");}}

No TIO-link, because Java 5/6 is old.. In Java 5/6 it was possible to have an enum with code instead of the mandatory main-method, making it shorter for full program challenges.

Also errors with java.lang.NoSuchMethodError: main\nException in thread "main" in STDERR after printing to STDOUT, which is fine according to the meta (but if the challenge would have disallowed additional errors to STDERR, System.exit(0); can be added (and the octal numbers has to be updated) to prevent the error.

Suggested by @OlivierGrégoire (and his relevant Java tip).

Java 8+, 74 bytes (full program)

interface M{static void main(String[]a){System.out.print(0112+" bytes");}}

Try it online.

Java 8+, 16 15 bytes (lambda function)

v->0xF+" bytes"

-1 byte thanks to @OliverGégoire.

Try it online.

Kevin Cruijssen

Posted 2018-03-29T15:34:07.607

Reputation: 67 575

2Technically not a full program :) – O.O.Balance – 2018-03-29T15:54:40.313

@O.O.Balance Oops.. somehow read past that, thanks for the correction. There goes my score.. XD – Kevin Cruijssen – 2018-03-29T16:48:26.470

v->3*5+"bytes"? – Neil – 2018-03-29T19:35:13.850

@Neil It contains a 5, so I'm afraid that's not going to work. – Kevin Cruijssen – 2018-03-29T19:57:00.853

137*2 contains a 7, so it is not valid. Your alternative solution is fine though. – O.O.Balance – 2018-03-29T23:01:16.937

@O.O.Balance Oops.. not sure how I missed that. Removed it. – Kevin Cruijssen – 2018-03-30T06:56:06.693

1v->0xE+"bytes" or v->0xF+" bytes". Can't test but should work anyways. Nothing says the score and "bytes" must be separated. – Olivier Grégoire – 2018-03-30T10:56:42.810

@OlivierGrégoire Thanks. As for whether there need to be a space before bytes, as expected when I looked in the challenge edit it stated " bytes", so the space is mandatory. I edited the challenge description to <code> bytes</code> and also added the rule explicitly to make it more clear the space between the number and bytes is mandatory. Thanks for the -1 with the hexadecimal number 0xF though. – Kevin Cruijssen – 2018-03-30T11:29:39.727

enum H{H;{System.out.print(<octal or hex>+" bytes");System.exit(0);}} for both Java 5 and 6. – Olivier Grégoire – 2018-03-30T14:31:30.173

1

@OlivierGrégoire I know, I know. ;) When I posted the full program I was doubting to answer it as enum thinking about your tip-answer. Do you know any online compiler that still supports it? I prefer to have a link with test code for my answers..

– Kevin Cruijssen – 2018-03-30T14:36:47.107

Then I posted it

– Olivier Grégoire – 2018-03-30T14:47:17.163

@OlivierGrégoire Oh, I was just done with my edit, lol.. Still looking for an online compiler for Java 5/6, though.. :( – Kevin Cruijssen – 2018-03-30T14:48:01.270

Now You use 053 to write 43. That's not allowed. Fixed by switching to hexa, for 1 extra byte. – Olivier Grégoire – 2018-03-30T18:16:36.237

@OlivierGrégoire Ah oops.. >.> Third time I made that mistake, wth.. I'm glad it's weekend now.. sigh. Thanks! – Kevin Cruijssen – 2018-03-30T18:32:08.873

4

dc, 14 11 bytes

[ bytes]Bnn

Try it online!

-3 bytes by @Cows quack

NieDzejkob

Posted 2018-03-29T15:34:07.607

Reputation: 4 630

[ bytes]Bnn shaves some bytes – user41805 – 2018-03-29T15:52:46.607

@Cowsquack thanks! – NieDzejkob – 2018-03-29T15:55:06.070

@cowsquack duckies go MOO, I'd assume :P? – Magic Octopus Urn – 2018-03-30T22:05:18.397

@MagicOctopusUrn Ducks, what are ducks? :P – user41805 – 2018-03-31T09:03:25.677

4

Octave, 23 bytes

printf('%i bytes',9+14)

Try it online!

And this:

disp(['','67$f}xiw'-4])

Try it online!

Stewie Griffin

Posted 2018-03-29T15:34:07.607

Reputation: 43 471

The first answers seems fine, but... how does the second one works? o.O – rafa11111 – 2018-03-29T18:14:18.870

2@rafa11111 Subtracting 4 from (the ASCII codes of) '67$f}xiw' gives the ASCII codes of '23 bytes'. Then, concatenating with the empty string '' converts ASCII codes to chars – Luis Mendo – 2018-03-29T19:07:06.387

2@Luis Mendo Pretty clever! Thanks for clarifying! – rafa11111 – 2018-03-29T19:13:56.660

4

APL (Dyalog Unicode), 12 bytes

Full program which implicitly prints to STDOUT.

'bytes',⍨3×4

Try it online!

,⍨ is appends the string to the result of the multiplication. APL's default display of mixed-type data puts a space between a number and subsequent text.

Adám

Posted 2018-03-29T15:34:07.607

Reputation: 37 779

I may be wrong, but don't you have a 2 in your byte count and program? 3*4 should be fine though – fyrepenguin – 2018-03-29T20:04:27.820

@fyrepenguin Heh, right you are, of course. How silly of me. – Adám – 2018-03-29T20:39:42.927

4

MATL, 13 bytes

'57$f}xiw'4-c

Try it online!

This pushes the string '57$f}xiw' and subtracts 4, to get 13 bytes. This is converted to characters using c.

Stewie Griffin

Posted 2018-03-29T15:34:07.607

Reputation: 43 471

6EV' bytes'h is 12 (I was just about to post it) – Giuseppe – 2018-03-29T16:11:35.343

1although it's the same boring approach :P – Giuseppe – 2018-03-29T16:11:54.990

4

Haskell, 26 bytes

main=putStr$"\50\54 bytes"

Try it online!


29 bytes

main=putStr$pred<$>"3:!czuft"

Try it online!

Laikoni

Posted 2018-03-29T15:34:07.607

Reputation: 23 676

Unnecessary whitespace is now forbidden, but you can use a $ instead. – Ørjan Johansen – 2018-03-30T00:57:31.657

@ØrjanJohansen Thanks for pointing out. – Laikoni – 2018-03-30T10:42:18.693

4

Octave, 22 bytes

disp([50 50 ' bytes'])

Try it online!

Luis Mendo

Posted 2018-03-29T15:34:07.607

Reputation: 87 464

4

Petit Computer BASIC, 11 bytes

?9+2,"bytes

Using a comma in a print statement will move the cursor over to the next multiple of the current tab size. In SmileBASIC, that is 4 by default, so this would output 11 bytes (2 spaces) but PTC BASIC used 3 instead, so the output has the correct spacing.

12Me21

Posted 2018-03-29T15:34:07.607

Reputation: 6 110

4

Applescript, 15 bytes

Yes, I’m going there.

9+6&”bytes”

DonielF

Posted 2018-03-29T15:34:07.607

Reputation: 743

1But... Your source code can not include any of the digits from your byte count – nicael – 2018-03-29T19:10:25.267

@nicael Dang, you’re right. One second then... – DonielF – 2018-03-29T19:12:03.163

Correct me if I'm wrong, but isn't a multibyte character (3 bytes in Unicode if I remember correctly), so this is more than 11 bytes? – caird coinheringaahing – 2018-04-03T00:35:38.750

@cairdcoinheringaahing ...Shoot. You’re right - “ is 2 bytes, upping this to 15. – DonielF – 2018-04-03T01:05:28.627

does this not still print 11? – Destructible Lemon – 2018-04-03T03:11:54.570

@DestructibleLemon Sigh... Edited. Again. – DonielF – 2018-04-03T03:37:09.663

4

Brain-Flak, 100 BYTES

((((((<>))))))(((()[[]]((((()()((((([][]){}){}())[()]))[[][]])()){})()[][]))[()()[]])[]){({}<>)<>}<>

Try it online!

Outputs the bytes part in all caps. Someone familiar with Brain-Flak might be really confused with all the ((<>)) at the beginning, but rest assured, they're only there to abuse the stack height nilad ([]) and none of the 0s they produce are printed.

Jo King

Posted 2018-03-29T15:34:07.607

Reputation: 38 234

4

Whitespace, 112 bytes

Just because nobody's done it yet:

   			    
	
 	   
   	 	  		
   	   	 	
   	 	 	  
   	 		  	
   	    	 
   	     

  
	
   
 
	  

 


   




Try it online!

Prints " BYTES" in caps, since uppercase letters have shorter binary ASCII codes. The commands in the program, in my own made up visible notation, are:

Push 112
PrintNum
Push 0
Push 0x53
Push 0x45
Push 0x54
Push 0x59
Push 0x42
Push 0x20
Label _
PrintChr
Dup
JumpZ S
Jump _
Label S
End

aschepler

Posted 2018-03-29T15:34:07.607

Reputation: 717

Ah, didn't notice there was already a Whitespace answer.. Here is a shorter one (104 bytes).. Will delete mine again. Here is the same with added highlighting and explanation.

– Kevin Cruijssen – 2018-03-30T15:02:44.933

Oh, hmm. I guess the text is short enough that implementing the loop actually hurts more than just repeating the PrintChar. (And I know, I can always drop the final NNN, but I really like not having errors.) – aschepler – 2018-03-30T18:21:14.637

4

FerNANDo, 79 bytes

3 3
1
2 2
0 1 3 3 1 2 2 3
0 1 3 3 2 1 0 2
0 1 3 0 0 1 0 1
0 3 3 1 0 0 3 1
1 1
1

Try it online!

primo

Posted 2018-03-29T15:34:07.607

Reputation: 30 891

3

Bash, 20 18 17 bytes

echo $[8+9] bytes

Try it online!

-2 bytes thanks to @manatwork.
-1 byte thanks to @boboquack.

NieDzejkob

Posted 2018-03-29T15:34:07.607

Reputation: 4 630

echo $[20-2] bytes for 18 bytes? – manatwork – 2018-03-29T17:20:58.723

@manatwork woah, I didn't know bash could do math like that – NieDzejkob – 2018-03-30T08:32:47.577

“The old format $[expression] is deprecated and will be removed in upcoming versions of bash.” — man bash. But in meantime we enjoy using it here in PPCG. – manatwork – 2018-03-30T08:37:15.623

2echo $[5#33] bytes also works for a score of 18. – Digital Trauma – 2018-03-30T17:40:51.160

1Doesn’t 8+9 work for 17? – boboquack – 2019-07-30T06:01:11.657

@boboquack Yes, it does. Nice. – NieDzejkob – 2019-07-30T21:54:17.487

3

C, 33 32 bytes

main(){printf("%d bytes",040);}

There is a trailing newline, which is not "unnecessary" since the C standard demands it. Try it online here.

Thanks to NieDzejkob for golfing 1 byte.

Alternative with the same bytecount, thanks to ErikF:

main(){printf("%d bytes",' ');}

Try it online here.

O.O.Balance

Posted 2018-03-29T15:34:07.607

Reputation: 1 499

, 040 for 32 bytes – NieDzejkob – 2018-03-29T15:58:28.347

, 040 is against the (updated) rules but I added a trailing newline instead of the space. Thank you! – O.O.Balance – 2018-03-29T16:25:57.477

2You could also use ,' ' to avoid any numerals at all! – ErikF – 2018-03-30T05:51:35.767

@ErikF now that is clever. thanks :) – O.O.Balance – 2018-03-30T11:15:07.247

31 bytes – Steadybox – 2018-03-30T11:53:59.253

@Steadybox nice catch. I prefer the printable character solutions though. – O.O.Balance – 2018-03-30T11:59:17.847

3

><>, 13 bytes

#o<" bytes"nd

Try it online!

hakr14

Posted 2018-03-29T15:34:07.607

Reputation: 1 295

3

JavaScript, 16 15 bytes

x=>0xf+' bytes'

Yair Rand

Posted 2018-03-29T15:34:07.607

Reputation: 381

_=>5*3+' bytes' – Neil – 2018-03-29T19:36:59.270

@Neil Both the code and the byte-count contains a 5 in that case.. – Kevin Cruijssen – 2018-03-29T20:04:29.123

@KevinCruijssen Bah, I can't believe I overlooked that. – Neil – 2018-03-29T21:17:34.427

Submissions are required to be full programs "write a full program to output its own code golf score!" – user41805 – 2018-04-15T12:55:25.820

3

Batch, 32 bytes

@@echo %COMSPEC:~-10,-010% bytes

COMSPEC is usually %WINDIR%\system32\cmd.exe so I extract the substring from 10 to 8 characters from the end. Old 16-byte self-referencing version:

@echo %~z0 bytes

Fortunately the byte count wasn't a multiple of 10.

Neil

Posted 2018-03-29T15:34:07.607

Reputation: 95 035

@manatwork OK, I hadn't seen that, here's a new version. – Neil – 2018-03-29T21:16:37.657

3

7Zip - 90 14 bytes

Hex dump:

00 75 0d 08 c0 00 0d 08 03 00 00 03 04 1d  

To use:

save into a source file, named anything.

run the compiler from the command line: 7z e [source name]

tuskiomi

Posted 2018-03-29T15:34:07.607

Reputation: 3 113

3

Excel VBA, 10 bytes

An anonymous VBE immediate window function that takes no input and outputs to the vbe immediate window.

?2*5"bytes

Output

10 bytes

Taylor Scott

Posted 2018-03-29T15:34:07.607

Reputation: 6 709

My Excel shows additional leading space. Is it allowed? – pajonk – 2018-03-30T09:04:44.880

@pajonk That is the default nature VBA's Print and ? statement when handling number types, and is generally accepted to be valid for PPCG. That said, it may the space may be forcefully removed by converting to a string, and then operating upon that string, such as ?6+7&&" bytes for 13 bytes. – Taylor Scott – 2018-03-30T17:28:55.040

3

C++ (GCC), 51 bytes

Thanks to @ceilingcat!

#import<iostream>
main(){std::cout<<063<<" bytes";}

Try it online!

C++ (GCC), 56 bytes

#import<iostream>
main(){std::cout<<(int)'8'<<" bytes";}

Try it online!

More portable version (60 bytes):

#import<iostream>
int main(){std::cout<<(int)'<'<<" bytes";}

#import is not standard C++, but should work at least with GCC, Clang, and MSVC.

Try it online!

Standard compliant version (61 bytes):

#include<iostream>
int main(){std::cout<<(int)'='<<" bytes";}

Try it online!

Steadybox

Posted 2018-03-29T15:34:07.607

Reputation: 15 798

Suggest 063 for (int)'8', 067 for (int)'<' and 070 for (int)'=' – ceilingcat – 2018-04-01T00:09:19.403

3

Quantum64

Posted 2018-03-29T15:34:07.607

Reputation: 371

3

Mathematica frontend, 18 bytes (maybe 10?)

Row@{2*9," bytes"}

Thanks to @ovs

A naughty way ... as I don't know whether this counts (10)

2" bytes"5

Well it depends on how you define space.

enter image description here

Wolfram Language (Mathematica), solution w/o frontend (30)

Print[ToString[5*6]<>" bytes"]

Try it online!

Keyu Gan

Posted 2018-03-29T15:34:07.607

Reputation: 2 028

3

Hexagony, 26 22 Bytes

B{3'/bs.<t>;ey;:!$@P0/

-4 Bytes @Jo King

Try it online!


More Readable:
   B { 3 '
  / b s . <
 t > ; e y ;
: ! $ @ P 0 /
 . . . . . .
  . . . . .
   . . . .

Reuses every semicolon twice similar to this answer.

Adyrem

Posted 2018-03-29T15:34:07.607

Reputation: 521

It even uses one of the semi-colons 4 times! – Jo King – 2018-09-28T11:20:36.253

3

Keg, 6 bytes

bytes

Uses an unprintable character at the beginning to push 6 to the stack. Then when it gets printed at the end, a space is automatically added after the 6 due to it being an integer.

Try it Online!

EdgyNerd

Posted 2018-03-29T15:34:07.607

Reputation: 1 106

3

Poetic, 277 bytes

for the A.I. system i did, i tried to put in humans
i know i am one of those
i am trying human testing for cyber-enabled virtual brains
a for-profit company rakes in massive loads of cash educating interns,
& then force-feeding things to all the interns until we earn a diploma

Outputs 277 bytes.

Try it online!

Poetic is an esolang I made in 2018 for a class project. It's basically brainfuck with word-lengths instead of symbols.

This was a fun program to write, although I'm not entirely sure I've fulfilled the "no unnecessary characters" requirement. If my answer needs to be amended, let me know!

JosiahRyanW

Posted 2018-03-29T15:34:07.607

Reputation: 2 600

1"& then force-feeding things to all the interns until we earn a diploma". Absolutely wonderful! – Lyxal – 2019-11-03T10:47:29.347

2

Pyth, 10 bytes

+T" bytes"

Try it here

If you don't mind separating with a newline instead of a space, you can get it down to 8 bytes with

y4"bytes

user48543

Posted 2018-03-29T15:34:07.607

Reputation:

2

CJam, 10 10 bytes

Ao" bytes"

Try it online!

Esolanging Fruit

Posted 2018-03-29T15:34:07.607

Reputation: 13 542

+1 for the no-op space used just to pad the byte count. Too bad CJam doesn't have a predefined variable with the initial value 9. – Ilmari Karonen – 2018-03-30T00:10:57.257

...although I just realized that the challenge forbids "[u]nnecessary spaces and newlines". But you could still do e.g. " bytes"A\ or A" bytes"+ to comply with the rules as specified. – Ilmari Karonen – 2018-03-30T00:34:02.083

@IlmariKaronen Ao" bytes" works. – Esolanging Fruit – 2018-03-30T03:10:50.313

2

J, 19 bytes

echo' bytes',~":_bj

Try it online!

FrownyFrog

Posted 2018-03-29T15:34:07.607

Reputation: 3 112

2

C# (.NET Core), 65 bytes

class P{static void Main(){System.Console.Write(0x41+" bytes");}}

Try it online!

Anderson Pimentel

Posted 2018-03-29T15:34:07.607

Reputation: 213

1I'm afraid your code contains a 5.. Easily fixed by using 72-7, though. – Kevin Cruijssen – 2018-03-29T16:53:58.017

2Fixed! With a little bit of hex to make it look clever! =D – Anderson Pimentel – 2018-03-29T17:12:41.490

A bit silly and crooked: class Q{static void Main(){new System.Exception("sixty four");}} => 64 and the word bytes is in the exception when you drill down through it! – PmanAce – 2018-03-29T17:30:20.840

2

SNOBOL4 (CSNOBOL4), 27 bytes

	OUTPUT =3 * 9 ' bytes'
END

Try it online!

prints with a trailing newline.

Giuseppe

Posted 2018-03-29T15:34:07.607

Reputation: 21 077

2

Japt, 8 bytes

#+` ßs

char-code 8 concatenated with " bytes" compressed.

Try it online!

Oliver

Posted 2018-03-29T15:34:07.607

Reputation: 7 160

1Identical to what I had, again. would also work. – Shaggy – 2018-04-02T15:56:32.230

2

Excel (Immediate Window), 12 bytes

?3*4&"bytes"

This solution assumes that leading space is allowed.
Below the one without leading space in output (14 bytes):

?2*7&&" bytes"

It's the result of suspicious behaviour of the concatenate operator &. When only one, it surrounds the number with spaces; however two consecutive ones strip the spaces. Weird.

pajonk

Posted 2018-03-29T15:34:07.607

Reputation: 2 480

2

Ruby, 18 bytes

puts"#{6*3} bytes"

Try it online!

benj2240

Posted 2018-03-29T15:34:07.607

Reputation: 801

2

brainfuck, 95 bytes

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

Try it online!

97 bytes:

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

Conor O'Brien

Posted 2018-03-29T15:34:07.607

Reputation: 36 228

2

Gol><>, 11 bytes

bn"setyb "H

Try it online!

How it works

bn"setyb "H
b            push number 11
 n           pop and print as integer
  "setyb "   push " bytes" in reverse order
          H  print the stack content as chars, then halt

Bubbler

Posted 2018-03-29T15:34:07.607

Reputation: 16 616

2

Google Sheets, 12 bytes

An anonymous worksheet function that takes no input and outputs to the calling cell

=3*4&" bytes

Taylor Scott

Posted 2018-03-29T15:34:07.607

Reputation: 6 709

2

MSSQL, 26 24 bytes

print str(8*3) +' bytes'

Oliver

Posted 2018-03-29T15:34:07.607

Reputation: 7 160

2

F#, 24 23 bytes

I hope this counts. Never code golfed before

printfn "%i bytes" 0x17

Just switched 24 to octal 23 to hex

Try it online!

an earwig

Posted 2018-03-29T15:34:07.607

Reputation: 141

Welcome to the site! It looks like you have some extraneous whitespace. Could that be removed? Also, I don't know a whole lot about F#, but are you sure this is a full program? The original rules stated write a full program to output it's own score – James – 2018-03-30T19:52:06.110

@DJMcMayhem whoops, dropped that extra space. Also I do believe this is a full program. It compiles and runs just fine in Visual Studio without anything else, though I may misunderstand what that means. – an earwig – 2018-03-30T19:56:17.547

Whoops, my bad. I assumed that F# was like C# where you need class declarations in a full program. Looks valid to me! – James – 2018-03-30T20:04:22.263

2

TI-Basic (TI-84 Plus CE with OS 5.2+), 14 bytes

toString(9+5)+" BYTES

toString( is a two-byte token, all other characters used are one-byte tokens.

toString( can be replaced with eval( for the same output and score.

Explanation:

  • toString(9+5) Returns the string "14"

  • +" BYTES Adds the string " BYTES", to get "14 BYTES"

  • TI-Basic implicitly returns/prints the last item evaluated, so 13 BYTES is output.

pizzapants184

Posted 2018-03-29T15:34:07.607

Reputation: 3 174

What calculator has a toString( function? – kamoroso94 – 2018-04-09T10:05:11.430

1

@kamoroso94 The TI-84 Plus CE. Source

– pizzapants184 – 2018-04-09T15:06:52.020

2

Windows Command Line, 20 bytes

set/a4*5&echo  bytes

Run Windows Command Prompt (cmd.exe), type the command and hit Enter.

img

Egor Skriptunoff

Posted 2018-03-29T15:34:07.607

Reputation: 688

2

SQL, 18 bytes

SELECT 2*9,'bytes'

Razvan Socol

Posted 2018-03-29T15:34:07.607

Reputation: 341

2

Swift 4, 19 18 bytes

Saved 1 byte thanks to Jo King.

print(9*2,"bytes")

Try it online!

xoudini

Posted 2018-03-29T15:34:07.607

Reputation: 161

Why not 9*2?- – Jo King – 2018-04-05T15:58:04.347

@JoKing What an oversight... Thanks! – xoudini – 2018-04-05T16:00:09.977

2

m4, 15 bytes

As in the m4 POSIX macro processor.

eval(8+7) bytes

FRex

Posted 2018-03-29T15:34:07.607

Reputation: 41

2

Vim, 12 10 bytes

i9<C-o><C-a> bytes

oktupol

Posted 2018-03-29T15:34:07.607

Reputation: 697

2

Backhand, 11 bytes

"" sbbeOytH

Try it online!

Non-linear pointer progression makes for weird looking programs. Outputs 11 bytes.

The orde: of commands is such:

"  s  e  t      Start string literal to push letters
                Bounce and go left
     b  y       Finish pushing " bytes"
                Bounce and go right
 "  b  O  H   Push 11 to print and then halt and output the stack

Jo King

Posted 2018-03-29T15:34:07.607

Reputation: 38 234

2

MathGolf, 9 bytes

G½ "bytes

Try it online!

Explanation

Quite simple really

G            Push 18
 ½           Halve the result, giving 9
             Push a space character
   "bytes    Push "bytes"

maxb

Posted 2018-03-29T15:34:07.607

Reputation: 5 754

2

C#, 68 65 64 bytes

class P{static void Main(){System.Console.Write(8*8+" bytes");}}

Try it online!

SiD

Posted 2018-03-29T15:34:07.607

Reputation: 141

Welcome to PPCG! Your program contains the digits 5 and 6 which you are printing, that's not allowed. – Ørjan Johansen – 2018-09-28T09:17:59.827

Fixed the program and thanks for the review @ØrjanJohansen – SiD – 2018-09-28T09:50:11.263

2

Python 2, 17 bytes

print 9+8,'bytes'

Output: 17 bytes

Matthew Anderson

Posted 2018-03-29T15:34:07.607

Reputation: 131

2

33, 14 bytes

Technically non-competing, as I made the language after this challenge was posted.

2c7xo" bytes"p

Pretty simple. Multiplies 2 and 7.

TheOnlyMrCat

Posted 2018-03-29T15:34:07.607

Reputation: 1 079

1

You're good as that rule has fallen to the wayside

– Veskah – 2019-07-30T14:43:56.863

Ah. Thanks for letting me know. – TheOnlyMrCat – 2019-07-30T22:13:30.717

1

Jelly, 7 bytes

“¢>¶ŒD»

Try it online!

Compressed strings.

Esolanging Fruit

Posted 2018-03-29T15:34:07.607

Reputation: 13 542

1

Python 2, 18 17 bytes

print 8+9,'bytes'

-1 byte thanks to @Wondercricket.

Try it online.

Kevin Cruijssen

Posted 2018-03-29T15:34:07.607

Reputation: 67 575

That trailing space is not in the output, I think it's still precisely what the rule is intended to forbid. However, you can use parentheses around 2*9 instead. – Ørjan Johansen – 2018-03-30T00:48:11.833

@ØrjanJohansen I changed it to 8+9 instead to save a byte. :) – Kevin Cruijssen – 2018-03-30T06:58:01.547

1

SOGL V0.12, 8 bytes

┌`m39Σ³‘

Try it Here!

dzaima

Posted 2018-03-29T15:34:07.607

Reputation: 19 048

1

Pari/GP, 18 bytes

print(2*9" bytes")

Try it online!

alephalpha

Posted 2018-03-29T15:34:07.607

Reputation: 23 988

1

MATL, 12 bytes

6EV' bytes'h

Try it online!

Pushes 6, doubles with E, converts that to a string with V, and horzcats it with the string ' bytes' to get the proper spacing. Implicit output takes care of the rest.

Giuseppe

Posted 2018-03-29T15:34:07.607

Reputation: 21 077

1

SmileBASIC, 12 bytes

?3*4;" bytes

(Probably works in a bunch of other BASIC dialects, too)

Alternatives:

?&HC;" bytes
?9+3;" bytes

12Me21

Posted 2018-03-29T15:34:07.607

Reputation: 6 110

1

jamal, 14 characters

{@* 2 7} bytes

Sample run:

bash-4.4$ perl jamal.pl ownsize.jam 
14 bytes

manatwork

Posted 2018-03-29T15:34:07.607

Reputation: 17 865

1

Fortran (GFortran), 24 bytes

PRINT*,11+13,'BYTES'
END

Try it online!

Outputs "24 BYTES" with some leading spaces, because, you know, it's Fortran... you can't tell him to do something and expect that he will do exactly as you said, specially if it involves strings :)

rafa11111

Posted 2018-03-29T15:34:07.607

Reputation: 310

1

Befunge-98 (FBBI), 12 bytes

"c.4k,@setyb

Try it online!

Thank you Jo King and Mistah Figgins for -3 bytes.

MegaTom

Posted 2018-03-29T15:34:07.607

Reputation: 3 787

213 bytes – Jo King – 2018-03-29T22:34:27.337

12 bytes – MildlyMilquetoast – 2018-04-21T19:01:47.480

1

PowerShell, 14 bytes

"$(2*7) bytes"

Try it online!

Ho-hum. Uses an inline code block $(...) to put 14 into the string before leaving it on the pipeline. Output is implicit.

AdmBorkBork

Posted 2018-03-29T15:34:07.607

Reputation: 41 581

1

TeX, 16 bytes

^^q^^v bytes\bye

siracusa

Posted 2018-03-29T15:34:07.607

Reputation: 623

1

Ruby, 15 bytes

p"#{0xf} bytes"

Try it online!

dkudriavtsev

Posted 2018-03-29T15:34:07.607

Reputation: 5 781

1

Foo, 13 bytes

&9+4$i" bytes

Try it online!

Explanation

&9+4$i" bytes
&9              push 9
  +4            add 4 (13)
    $i          output as integer
      " bytes   print out " bytes"

14 bytes

@20&$h" bytes"

Same general idea, but (ab)uses hexadecimal printing.

Conor O'Brien

Posted 2018-03-29T15:34:07.607

Reputation: 36 228

1

Pyth, 11 bytes

+hT" bytes"

Try it online!

chromaticiT

Posted 2018-03-29T15:34:07.607

Reputation: 211

Why do you have h? Doesn't that just add the eleventh byte that it's there to account for, and it can thus be removed safely? – Steven H. – 2018-04-10T22:21:12.003

1

Rust, 34 bytes

fn main(){print!("{} bytes",17*2)}

Try it online!

Konrad Borowski

Posted 2018-03-29T15:34:07.607

Reputation: 11 185

1

C# (Visual C# Interactive Compiler), 20 bytes

Write(11+9+" bytes")

Try it online!

arekzyla

Posted 2018-03-29T15:34:07.607

Reputation: 201

1

Excel, 13 bytes

=6+7&" bytes"

Output: 13 bytes

Nothing fancy. It's different from the other Excel answers as those are both based in VBA. This formula version is longer.

Engineer Toast

Posted 2018-03-29T15:34:07.607

Reputation: 5 769

1

C, 50 49 bytes

#include<stdio.h>
main(){printf("%d bytes",'1');}

Cyclonecode

Posted 2018-03-29T15:34:07.607

Reputation: 231

1

T-SQL, 32 bytes

print char(51)+char(50)+' bytes'

Best I could come up with.

Probably

Posted 2018-03-29T15:34:07.607

Reputation: 207

1

Javascript,26 bytes

console.log(78/3+" bytes")

Try it online!

SuperStormer

Posted 2018-03-29T15:34:07.607

Reputation: 927

1

Husk, 8 bytes

+sD4¨₆Ẏ¿

Try it online!

Explanation

+sD4¨₆Ẏ¿
    ¨₆Ẏ¿  Compressed string of " bytes"
  D4        Multiply 4 by 2
 s          Convert to string
+         Concatenate the strings

Fyr

Posted 2018-03-29T15:34:07.607

Reputation: 561

1

Octave, 42 bytes

I figured I'd try a more interesting approach that's Octave-specific (and only works on some platforms).

printf('%i bytes',printf('%c',8+~(10:51)))

Note: This doesn't work on TIO or Octave-online.net, but it does work on Octave 4.2.0 on my laptop.

Explanation:

printf('%i bytes',... ) specifies that we will print a string starting with an integer %i followed by the characters ' bytes'. The second part of the first printf-function call is another call to printf('%c',...). When printf is called with an output argument, it returns the number of characters in the output string, as well as the string. The second part of the second printf call is 8+~(10:51). This is a shorter way to write [8, 8, 8 ...] 42 times. 8 is the ASCII-value of the backspace. The string to be printed is therefore 42 backspaces. This doesn't show when typing it in the terminal, so we'll get 42 bytes without a trailing newline:

enter image description here

Stewie Griffin

Posted 2018-03-29T15:34:07.607

Reputation: 43 471

1

MySQL, 28 bytes

SELECT CONCAT(7*4,' bytes');

Cyclonecode

Posted 2018-03-29T15:34:07.607

Reputation: 231

1

Tcl, 23 bytes

puts [scan  %c]\ bytes

Try it online!


Tcl, 23 bytes

puts [expr 19+4]\ bytes

Try it online!

sergiol

Posted 2018-03-29T15:34:07.607

Reputation: 3 055

1

ArnoldC, 216 Bytes

Try it online!

IT'S SHOWTIME
    HEY CHRISTMAS TREE i
    YOU SET US UP 4
    GET TO THE CHOPPER i
        HERE IS MY INVITATION i
        YOU'RE FIRED 54
    ENOUGH TALK
    TALK TO THE HAND i
    TALK TO THE HAND "BYTES"
YOU HAVE BEEN TERMINATED

Output

216
BYTES

Well, i took too long with my php answer, i had to try this.

As far as i read, i can't write without a line break or concatenate an integer with a string :(

Francisco Hahn

Posted 2018-03-29T15:34:07.607

Reputation: 591

1

Attache, 19 bytes

Print&$bytes!STN!$t

Try it online!

Explanation

Print&$bytes!STN!$t
Print       !          print
     &$bytes           (with "bytes" as a right argument)
             STN!      convert string to number...
                 $t    "t" (corresponds to 19)

In sane syntax, this is: Print[STN["t"], "bytes"], which joins the arguments by spaces.

Conor O'Brien

Posted 2018-03-29T15:34:07.607

Reputation: 36 228

1

vim, 12 bytes

a9 bytes<ESC>03<C-A>

<ESC> is 0x1b. <C-A> is 0x01

Try it online!

Ray

Posted 2018-03-29T15:34:07.607

Reputation: 1 488

1

MBASIC, 17 bytes

6 PRINT 8+9"bytes

MBASIC requires line numbers; "6" doesn't appear in the output either. Turns out that the trailing quote is optional.

Output:

RUN
 17 bytes
Ok

wooshinyobject

Posted 2018-03-29T15:34:07.607

Reputation: 171

1Byte count is calculated from the source code, not the RAM it takes up. So this should be 18 bytes. But +1 for using an uncommon language; we need more variety around here. – Ray – 2018-09-27T18:23:34.490

1Even with a tokenizing interpreter? – wooshinyobject – 2018-09-27T19:08:17.387

Yes. If the size of the target language/object code/internal representation mattered, the score would change every time improvements were made to the implementation's optimizer. And there would be a lot of situations where making the source code larger would make the target code smaller, and vice versa, since optimizers work better when they have a lot of explicit information about what assumptions are safe to make. – Ray – 2018-09-28T01:58:35.717

1

Cubix, 23 bytes

@"!w"SETYB"uUo<S;O'$.;

Try it online!

Cubified:

    @ "
    ! w
" S E T Y B " u
U o < S ; O  '
    $ .
    ; .

Watch it run

Failrly simple pushes SETYB onto the stack, pushes character 23 (ETB) and outputs as an integer. Push 32 (space) onto the stack then start outputting chars and popping until stack is empty.

MickyT

Posted 2018-03-29T15:34:07.607

Reputation: 11 735

1

Pascal (FPC), 29 bytes

begin write($1D,' bytes')end.

Try it online!

$1D is a hexadecimal constant. I'm glad Pascal has something shorter than other languages!

AlexRacer

Posted 2018-03-29T15:34:07.607

Reputation: 979

1

Python 3, 18 bytes

print(9*2,'bytes')

Try it online!

SiD

Posted 2018-03-29T15:34:07.607

Reputation: 141

1

k (oK), 16 bytes

Try it online!

($:4*4)," bytes"

String result of 4*4 and concatenate

Thaufeki

Posted 2018-03-29T15:34:07.607

Reputation: 421

1

Chevron, 12 bytes

^n<<3*4
>^n

This is a fairly new language of my own creation - prototype interpreter, documentation, and example programs can be found at https://github.com/superloach/chevron.

Explanation:

  • ^n<<3*4 - calculate 3*4, store as n
  • >^n - output n
  • nothing else - implicit exit

Superloach

Posted 2018-03-29T15:34:07.607

Reputation: 71

1

Deadfish~, 59 bytes

iisioiiiioii{ii}icii{iii}iic{ii}iiicdddddc{d}dddddc{i}iiiic

Try it online!

a stone arachnid

Posted 2018-03-29T15:34:07.607

Reputation: 1 053

1

C++, 52 bytes

[]{std::string a="41 bytes";a[0]++;a[1]++;return a;}

Try it online!

facepalm is it even competable? it just barely wins against BF! but still, no 5s and 2s in the code.

Matthew Roh

Posted 2018-03-29T15:34:07.607

Reputation: 5 043

1

Pyramid Scheme, 477 bytes

      ^      ^      ^      ^      ^      ^
     / \    / \    / \    / \    / \    / \
    /out\  /out\  /out\  /out\  /out\  /out\
   ^-----^ -----^ -----^ -----^ -----^ -----^
  /*\   / \    / \    / \    / \    / \    / \
 ^---^ /chr\  /chr\  /chr\  /chr\  /chr\  /chr\
/9\ / \-----^ -----^ -----^ -----^ -----^ -----^
---/53 \   / \    / \    / \    / \    / \    / \
   -----  /32 \  /98 \  /121\  /116\  /101\  /115\
          -----  -----  -----  -----  -----  -----    

Try it online!

Outputs 477 bytes by multiplying 9 by 53. This only has 4 extra whitespace to pad out the number to one that can be represented properly.

Jo King

Posted 2018-03-29T15:34:07.607

Reputation: 38 234

1

C, 31 bytes

main(){printf("%d bytes",'');}

Try It Online!

The unprintable character is the unit separator which value is 31.

bmann

Posted 2018-03-29T15:34:07.607

Reputation: 21

1

Runic Enchantments, 10 bytes

` ā`XESa@

Try it online!

Huh, I thumbed this one up and never answered it.

ā encodes the value 257 (still shorter than any other method) which gets multiplied by 10 and converted to a word via a dictionary. 2570 happens to be bytes. a encodes 10 (b-f encode 11 through 15) and gets around the "no digits" restriction. And conveniently enough, the rest of the program is 9 bytes.

Doesn't end up being shorter than " bytes"a@ (also 10 bytes), but oh well.

Draco18s no longer trusts SE

Posted 2018-03-29T15:34:07.607

Reputation: 3 053

1

W d, 7 bytes

♣êæ█☺₧K

Explanation

Unpacked:

7 bytes"

user85052

Posted 2018-03-29T15:34:07.607

Reputation:

0

JavaScript, 20 bytes

alert(5*4+" bytes");

Esolanging Fruit

Posted 2018-03-29T15:34:07.607

Reputation: 13 542

1Unnecessary characters, spaces, and newlines are forbidden in the source code – l4m2 – 2018-03-31T12:50:01.440

1@l4m2 Fixed now. – Esolanging Fruit – 2018-03-31T19:33:57.930

0

Jotlin, 17 bytes

P("${8+9} bytes")

Uses the println builtin

jrtapsell

Posted 2018-03-29T15:34:07.607

Reputation: 915

0

Attache, 18 bytes

Print[!4-6,$bytes]

Try it online!

This is simply printing !4-6 (which is factorial(4) - 6) followed by bytes.

Conor O'Brien

Posted 2018-03-29T15:34:07.607

Reputation: 36 228

0

Groovy, 22 bytes

{print"${0x16} bytes"}

Try it online!

Magic Octopus Urn

Posted 2018-03-29T15:34:07.607

Reputation: 19 422

0

AWK, 19 14 bytes

$0=2*7" bytes"

Try it online!

Robert Benson

Posted 2018-03-29T15:34:07.607

Reputation: 1 339

1I don't get the point in using the x variable. Why not $0=2*7" bytes" for 14 bytes? – manatwork – 2018-03-29T18:11:48.710

1Well obviously it's because I didn't think of it. :p – Robert Benson – 2018-03-30T12:37:42.000

0

Pyt, 35 bytes

2⁵1⁺ᴇ⁻⁻1ᴇ⁺²2ᴇ4²+9⁺²⁺1ᴇ⁺²6-áƇǰ8Ḟ1+⇹ǰ

Try it online!

Explanation:

2⁵         Push 32
1⁺ᴇ⁻⁻      Push 98
1ᴇ⁺²       Push 121
2ᴇ4²+      Push 116
9⁺²⁺       Push 101
1ᴇ⁺²6-     Push 115
á          Convert stack to array, and push the array onto the stack
Ƈ          Cast to characters ([" ","b","y","t","e","s"])
ǰ          Join the elements of the array (" bytes")
8Ḟ1+       Push 35
⇹          Swap the top two elements on the stack
ǰ          Concatenate the stack as a string ("35 bytes")
           Implicit print

mudkip201

Posted 2018-03-29T15:34:07.607

Reputation: 833

0

Batch, 31 bytes

@set /a r=29+2 
@echo %r% bytes

Romen

Posted 2018-03-29T15:34:07.607

Reputation: 161

6The source code is not allowed to include any of the digits of the byte count. 20*2 contains a zero. – Yair Rand – 2018-03-29T22:26:18.197

For only two lines, no @echo off to optimize – l4m2 – 2018-03-31T12:52:32.347

Thanks l4m2, I have shortened the answer and corrected my mistake. – Romen – 2018-04-02T13:22:38.477

1Save two bytes: @set/ar=33-4. – Neil – 2018-04-08T10:41:18.073

0

Swift, 22 bytes

print("\(18+4) bytes")

Try it online!

Tamás Sengel

Posted 2018-03-29T15:34:07.607

Reputation: 211

0

K4, 18 15 bytes

Solution:

($6+9)," bytes"

Example:

q)k)($6+9)," bytes"
"15 bytes"

Explanation:

Evaluated right-to-left, don't think I can get lower than 15 this way:

($6+9)," bytes" / the solution
      ," bytes" / join " bytes" with...
(    )          / do together
  6+9           / 6+9 = 15
 $              / cast to string

Alternative:

Another 15 byte solution, has potential to be golfed if anyone can make "41" in 4 chars or "31" in 3 chars:

|"setyb ",$49+2

streetster

Posted 2018-03-29T15:34:07.607

Reputation: 3 635

0

Pip, 10 bytes

t." bytes"

Try it online!

Conveniently, there's a preset variable for the number 10.

DLosc

Posted 2018-03-29T15:34:07.607

Reputation: 21 213

0

Yabasic, 15 bytes

An anonymous answer that takes no input and outputs to STDOUT.

?7+8;
?" bytes"

Try it online!

Taylor Scott

Posted 2018-03-29T15:34:07.607

Reputation: 6 709

0

uBASIC, 14 bytes

An anonymous answer.

0?2*7;" bytes"

Try it online!

Taylor Scott

Posted 2018-03-29T15:34:07.607

Reputation: 6 709

0

MY-BASIC, 18 bytes

An anonymous MY-BASIC answer that outputs to STDOUT.

Print 9+9," bytes"

Try it online!

Taylor Scott

Posted 2018-03-29T15:34:07.607

Reputation: 6 709

0

Visual Basic .NET (Mono), 66 bytes

A declared Subroutine that takes no input and outputs to the console.

Module M
Sub Main
Console.Write(3*22 &" bytes")
End Sub
End Module

Try it online!

Taylor Scott

Posted 2018-03-29T15:34:07.607

Reputation: 6 709

0

Red, 19 bytes

prin[22 - 3 'bytes]

Try it online!

Galen Ivanov

Posted 2018-03-29T15:34:07.607

Reputation: 13 815

0

jshell, 12 bytes

9+3+" bytes"

I don't think it's on TIO.run despite having an article on Wikipedia.

Konrad Borowski

Posted 2018-03-29T15:34:07.607

Reputation: 11 185

For whatever reason, JShell requires TCP sockets to start up. For security reasons, those aren't available in TIO's sandbox. – Dennis – 2018-03-30T17:16:30.767

0

Neim, 10 bytes

μ( bytes)B

μ represents 10.

Try it online!

Okx

Posted 2018-03-29T15:34:07.607

Reputation: 15 025

0

Bash, 17 Bytes

echo $[8+9] bytes

output:

17 bytes

Jared K

Posted 2018-03-29T15:34:07.607

Reputation: 893

0

Vim, 13 Bytes

i<Ctrl-r>=7+6<Enter> bytes

Jared K

Posted 2018-03-29T15:34:07.607

Reputation: 893

0

FALSE, 11 bytes

'\u000B." bytes"

\u000B should be replaced by the corresponding character.

12Me21

Posted 2018-03-29T15:34:07.607

Reputation: 6 110

0

Go, 66 64 bytes

package main;import"fmt";func main(){fmt.Printf("%d bytes",'@')}

Cyclonecode

Posted 2018-03-29T15:34:07.607

Reputation: 231

0

Haxe, 20 bytes

trace(4*5+' bytes');

Try it online!

darrylyeo

Posted 2018-03-29T15:34:07.607

Reputation: 6 214

0

C# (.NET Core), 16 bytes

n=>8*2+" bytes";

Try it online!


39 bytes

n=>System.Console.Write(~-40+" bytes");

Not sure whether returning the output from a function is valid, if not, here's a 39 byte solution.

Try it online!

Ian H.

Posted 2018-03-29T15:34:07.607

Reputation: 2 431

0

Hoon, 23 bytes

(runt 1^0vcpi " bytes")

(runt [p q] "tape") prepends a byte sequence q to a string p number of times. p^q is sugar for [p q], and 0vXXX is base32 (@uv) encoding for the byte string '23'.

RenderSettings

Posted 2018-03-29T15:34:07.607

Reputation: 620

0

Pyke, 9 bytes

75 02 94 0A 09 58 EF 64 4A

Try it here!

u 02 94 0A 09      - integer list, length 2 ([2570, 9])
             X     - splat(^)
              .o   - lookup 2570 in dictionary (bytes)
                dJ - join by " "

Blue

Posted 2018-03-29T15:34:07.607

Reputation: 26 661

0

V, 13 bytes

a20 bytes<esc>^7<C-x>

<esc> is \x1B and <C-x> is \x18.

Try it online!

Herman L

Posted 2018-03-29T15:34:07.607

Reputation: 3 611

0

Ly, 14 bytes

72*u" bytes"&o

Try it online!

I tried a solution based on Ly's quine, but it quickly turned out to cost more bytes than it saved.

LyricLy

Posted 2018-03-29T15:34:07.607

Reputation: 3 313

0

Clojure, 24 bytes

(println(+ 17 7)"bytes")

Try it online!

Joshua

Posted 2018-03-29T15:34:07.607

Reputation: 231

0

Emojicode, 46 bytes

38 8 bytes

Try it online!

I wanted to add my own answer to this question, but seeing as y’all took all the GOOD languages, I had to pick one of the weird ones

X1M4L

Posted 2018-03-29T15:34:07.607

Reputation: 1 586

0

Lua, 21 bytes

print(3*7 ..' bytes')

The space before .. (string concatenation operator) is required or the parser sees 7.. as a malformed number.

FRex

Posted 2018-03-29T15:34:07.607

Reputation: 41

0

Aceto, 16 15 bytes

es7+
t"8p
ybp
"

We first push " bytes", then 78+ (15) and then print both.

edit: Fixed counting final newline character edit2: Saved 1 byte thanks to Jo King

L3viathan

Posted 2018-03-29T15:34:07.607

Reputation: 3 151

115 bytes – Jo King – 2018-04-08T22:10:57.360

0

Excel, 13 bytes

=4+9&" bytes"

Using CONCATENATE for 28 bytes:

=CONCATENATE(4*6+4," bytes")

Wernisch

Posted 2018-03-29T15:34:07.607

Reputation: 2 534

0

Ruby, 16 bytes

p "#{9+7} bytes"

Try it online!

AJFaraday

Posted 2018-03-29T15:34:07.607

Reputation: 10 466

0

Go, 46 Bytes

package main;func main(){print(38+8," bytes")}

Pizza lord

Posted 2018-03-29T15:34:07.607

Reputation: 119

3Yeah, but now you have no space between the number and the bytes – Jo King – 2018-09-27T14:40:52.907

0

LOWER, 93 bytes

ₔ₉₃ₔₓ₃₂ₔₓ₉₈ₔₓ₁₂₁ₔₓ₁₁₆ₔₓ₁₀₁ₔₓ₁₁₅

Try it online!

This is all Unicode characters, so no 9s or 3s here.

Conor O'Brien

Posted 2018-03-29T15:34:07.607

Reputation: 36 228

0

JavaScript (Node.js), 22 bytes

alert(`${8+14} bytes`)

Muhammad Salman

Posted 2018-03-29T15:34:07.607

Reputation: 2 361

ok. will do that. – Muhammad Salman – 2018-04-15T13:06:37.490

@Cowsquack : There done. Thanks for the info – Muhammad Salman – 2018-04-15T13:32:23.790

OK? I see what the point is. It must outputting that on its own. Ok will update that. – Muhammad Salman – 2018-04-15T14:37:08.770

Nice, this works fine now :) – user41805 – 2018-04-15T14:40:16.747

@Cowsquack: Thanks you for all the help. – Muhammad Salman – 2018-04-15T14:46:15.777

0

Make, 96 bytes

d=$1 $1 $1 $1 $1 $1 $1 $1
all:
	@echo $(words $(call d,x x x x x x x) $(call d,x x x x x)) bytes

Try it online!

Logern

Posted 2018-03-29T15:34:07.607

Reputation: 845

See this and this standard loophole. I do not think that your answer is valid.

– Jonathan Frech – 2018-09-26T20:16:43.070

@JonathanFrech fixed – Logern – 2018-09-26T21:39:27.843

0

Pepe, 74 bytes

rEeEeeEeEereEEreeeEeeeeereeEEeeeEereeEEEEeeEreeEEEeEeereeEEeeEeEreeEEEeeEE

Try it online!

It's a boring answer, rEeEeeEeEereEE pushes 74 into stack r and outputs the number, and the rest of the code prints bytes

u_ndefined

Posted 2018-03-29T15:34:07.607

Reputation: 1 253

0

Python (REPL), 16 bytes

'%d bytes'%(8*2)

Output :

16 bytes

dieter

Posted 2018-03-29T15:34:07.607

Reputation: 2 010

7You could use f-strings like f'{7*2} bytes' – Jo King – 2018-09-27T14:34:24.093

Or, if you insist on using an older version of Python, you could use raw string r'%d bytes'%14 – mypetlion – 2018-09-27T16:04:04.383

0

LOLCODE, 66 bytes

Just because it's funny

HAI 1.2,VISIBLE SMOOSH PRODUKT OF 2 AN 33 AN " bytes" MKAY,KTHXBYE

Output

66 bytes

Robin B

Posted 2018-03-29T15:34:07.607

Reputation: 101

0

C (gcc), 32 bytes

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

Nothing crazy here.

SIGSTACKFAULT

Posted 2018-03-29T15:34:07.607

Reputation: 585

0

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

Shaun Bebbers

Posted 2018-03-29T15:34:07.607

Reputation: 1 814

0

naz, 48 44 bytes

2a2a2o2s2m8m1o2m2a1o9a9a5a1o5s1o9s6s1o9a5a1o

Explanation

2a2a2o   # Output "4" twice
2s2m8m1o # Output a space
2m2a1o   # Output "B"
9a9a5a1o # Output "Y"
5s1o     # Output "T"
9s6s1o   # Output "E"
9a5a1o   # Output "S"

Original 48-byte solution: 2a2a1o2a2a1o2m2m1o3m2a1o9a9a5a1o5s1o9s6s1o9a5a1o

sporeball

Posted 2018-03-29T15:34:07.607

Reputation: 461

0

RProgN 2, 10 bytes

°' Bytes'.

Explination

°           # Push 10 to the stack
 ' Bytes'   # Push the literal string " Bytes" to the stack
         .  # Concatenate. Implicit print.

Try it online!

ATaco

Posted 2018-03-29T15:34:07.607

Reputation: 7 898

0

Zsh, 16 bytes

<<<$[8*2]\ bytes

Try it online!

Heavily inspired by the Bash answer. <<< usually saves two bytes, but we lose one to escape a space.

GammaFunction

Posted 2018-03-29T15:34:07.607

Reputation: 2 838

0

x86-16 ASM, IBM PC DOS, 36 29 bytes

Listing:

        START: 
B0 1D       MOV  AL, SZ         ; get program size 
D4 0A       AAM                 ; BCD convert byte (AH=ones, AL=tens) 
86 E0       XCHG AH, AL         ; endian convert (AH=tens, AL=ones) 
50          PUSH AX             ; save AH = 9 
3030        ADD  AX, '00'       ; ASCII convert 
BF 0114     MOV  DI, OFFSET S   ; output string in DI 
8B D7       MOV  DX, DI         ; and output string in DX 
AB          STOSW               ; write digits to beginning of string 
58          POP  AX             ; restore AH = 9 (DOS write string function) 
CD 21       INT  21H            ; write to console 
C3          RET                 ; return to DOS
        S   DB '   bytes$'      ; output string buffer
        SZ  EQU LOW $-START     ; subtract starting address from ending address

Calculates the difference between the START memory address and the ending memory address. Then writes that value as decimal ASCII followed by the string ' bytes'.

There are no 0x02, 0x09, ASCII '2' (0x32) or ASCII '9' (0x39) in the code.

Output:

enter image description here

640KB

Posted 2018-03-29T15:34:07.607

Reputation: 7 149