17
\$\begingroup\$

Challenge:

Your task is to use any language to output that language's name times the number of character's in its name.

  • Use the common name or acronym of the language.
  • If there are multiple versions of a language, you need not include the version number.
  • The capitalization matters.

Examples:

PHP -> PHPPHPPHP
Java -> JavaJavaJavaJava
C++ -> C++C++C++
Python 3 -> PythonPythonPythonPythonPythonPython
JavaScript -> JavaScriptJavaScriptJavaScriptJavaScriptJavaScriptJavaScriptJavaScriptJavaScriptJavaScriptJavaScript
\$\endgroup\$
24
  • 31
    \$\begingroup\$ Tasks that depend on a language's name are a form of disadvantaging some languages by arbitrary criteria. \$\endgroup\$ Commented Dec 17, 2017 at 15:08
  • 18
    \$\begingroup\$ I think this challenge would have been a lot more interesting if the repetition count was supposed to be our bytecount... \$\endgroup\$
    – Maya
    Commented Dec 17, 2017 at 16:53
  • 15
    \$\begingroup\$ And because it hasn't been said yet: Welcome to PPCG! I hope you stick around despite your probably confusing first impression of people telling you that this is not a good challenge while one answer after the other arrives. \$\endgroup\$
    – Laikoni
    Commented Dec 17, 2017 at 21:06
  • 3
    \$\begingroup\$ @DonielF is that shortest though? \$\endgroup\$
    – Quintec
    Commented Dec 18, 2017 at 20:09
  • 4
    \$\begingroup\$ IMO this is unclear. Use the common name suggests that, for example, JS could be used for JavaScript. But what's to stop me saying that my language "Language" is more commonly known as "L"? \$\endgroup\$
    – FlipTack
    Commented Dec 24, 2017 at 19:25

97 Answers 97

2
\$\begingroup\$

sed, 10 bytes

isedsedsed

I hope two trailing newlines are OK :P

Try it online!

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

itflabtijtslwi, 31 bytes

/I/itflabtijtslwi//J/IIIIIII/JJ

Try it online!

\$\endgroup\$
2
\$\begingroup\$

Bubblegum, 14 13 bytes

Saved 1 byte thanks to @ovs

00000000: 732a 4d4a ca49 4d2f cda5 1603 00         s*MJ.IM/.....

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ 13 bytes, generated with zopfli. \$\endgroup\$
    – ovs
    Commented Dec 17, 2017 at 19:24
  • \$\begingroup\$ @ovs Thanks! I was pretty sure I was doing it wrong. \$\endgroup\$
    – Arnauld
    Commented Dec 17, 2017 at 19:34
2
\$\begingroup\$

Hexadecimal Stacking Pseudo-Assembly Language, 636 bytes

20002D4077FF00AAAA20006540000020006740000020006140000020007540000020006740000020006e40000020006140000020004c40000020002040000020007940000020006c40000020006240000020006d40000020006540000020007340000020007340000020004140000020002d40000020006f40000020006440000020007540000020006540000020007340000020005040000020002040000020006740000020006e40000020006940000020006b40000020006340000020006140000020007440000020005340000020002040000020006c40000020006140000020006d4000002000694000002000634000002000654000002000644000002000614000002000784000002000654000002000484000001400004277FF4099FF2000014077FF4299FF4077FF2277FF4277FF4077FF0377FF04000101AAAA

Try it online!

Formatted:

20002D4077FF00AAAA200065400000200067400000200061400000200075
40000020006740000020006e40000020006140000020004c400000200020
40000020007940000020006c40000020006240000020006d400000200065
40000020007340000020007340000020004140000020002d40000020006f
400000200064400000200075400000200065400000200073400000200050
40000020002040000020006740000020006e40000020006940000020006b
400000200063400000200061400000200074400000200053400000200020
40000020006c40000020006140000020006d400000200069400000200063
400000200065400000200064400000200061400000200078400000200065
4000002000484000001400004277FF4099FF2000014077FF4299FF4077FF
2277FF4277FF4077FF0377FF04000101AAAA 

Explanation

; initialize 77 with 0x002D (45)
20 002D
40 77 (FF)

; label AAAA
00 AAAA

; print out the text
20006540000020006740000020006140000020007540000020006740000020006e40000020006140000020004c400000200020400000
20007940000020006c40000020006240000020006d40000020006540000020007340000020007340000020004140000020002d400000
20006f40000020006440000020007540000020006540000020007340000020005040000020002040000020006740000020006e400000
20006940000020006b40000020006340000020006140000020007440000020005340000020002040000020006c400000200061400000
20006d400000200069400000200063400000200065400000200064400000200061400000200078400000200065400000200048400000
140000

; decrement
    ; move counter to stack 99
        42 77 (FF)
        40 99 (FF)
    ; push 1 to 77
        20 0001
        40 77 (FF)
    ; move counter to stack 77
        42 99 (FF)
        40 77 (FF)
    ; subtract
        22 77 (FF)

; duplicate
42 77 (FF)
40 77 (FF)

; terminate if counter is 0
03 77 (FF)
04 (0001)

; redo
01 AAAA
\$\endgroup\$
0
2
\$\begingroup\$

Hodor, 38 bytes

hodor.hod("HodorHodorHodorHodorHodor")

It's actually shorter than the pure Javascript equivalent!

Try it online!

\$\endgroup\$
2
\$\begingroup\$

PHP (9 bytes)

PHPPHPPHP

Try it online

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Hah. can't believe str_repeat(3,'PHP') is the long alternative. \$\endgroup\$ Commented Dec 19, 2017 at 14:55
  • 1
    \$\begingroup\$ Excuse my brevity with this answer; it's hardly a difficult challenge and by the questions posed above, it's apparently a perfectly legal one as well. \$\endgroup\$ Commented Dec 19, 2017 at 17:19
2
\$\begingroup\$

TI-BASIC, 16 bytes

"TI-BASIC
Disp Ans,Ans
Ans

Alternatively (19 bytes):

For(I,1,3
Disp "TI-BASIC
End
\$\endgroup\$
2
\$\begingroup\$

Standard ML (MLton), 55 54 46 bytes

val s="Standard ML";s^s^s;print(it^it^it^s^s);

Try it online!

Output:

Standard MLStandard MLStandard MLStandard MLStandard MLStandard MLStandard MLStandard MLStandard MLStandard MLStandard ML

Previous version: (55 bytes)

"Standard ML";print(concat(map(fn _=>it)(explode it)));

Try it online! (No worries, the code is harmless, eventhough it contains explode it.)

Explanation:

"Standard ML"; binds the string to the implicit value identifier it. We then explode it to convert the string into a list of characters and map a function fn _=>it over the list which replaces each character with the string. concat combines the list of strings to a single string and print outputs the resulting string.

\$\endgroup\$
2
\$\begingroup\$

Bash, 14 bytes

echo bash{,,,}

Try it online!

ksh, 12 bytes

echo ksh{,,}

Try it online!

sh, 10 bytes

echo sh{,}

Try it online!

Although, for 9 bytes, I can just do echo shsh.

\$\endgroup\$
2
\$\begingroup\$

Underload, 28 bytes

(Underload)::::::::********S

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ (Underload)::**::**S for 20 bytes. \$\endgroup\$ Commented Oct 22, 2019 at 15:44
2
\$\begingroup\$

brainfuck, 125 119 bytes

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

First BF, I think it's still golfable but it may be a bit BF to golf BF ;)

Explanation:

+++++++++                        (_009  000  000  000  000)
[
 >+++++++++++                    ( 009 _011  000  000  000)
 [
  >+++++++++                     ( 009  011 _009  000  000)
  [
   >+>+<<-                       ( 009  011 _008  001  001)
  ]                              ( 009  011 _000  009  009)
  >>+<<<-                        ( 009 _010  000  009  010)
 ]                               ( 009 _000  000  099  110)
 >>-.                            ( 009  000  000 _098  110) Output: b
 >++++.                          ( 009  000  000  098  114) Output: r
 <-.                             ( 009  000  000 _097  114) Output: a
 ++++++++.                       ( 009  000  000 _105  114) Output: i
 >----.                          ( 009  000  000  105 _110) Output: n
 <---.                           ( 009  000  000 _102  110) Output: f
 >+++++++.                       ( 009  000  000  102 _117) Output: u
 <---.                           ( 009  000  000 _099  117) Output: c
 ++++++++.                       ( 009  000  000 _107  117) Output: k
 >[-]<[-]<<<-                    (_008  000  000  000  000)
]                                (_000  000  000  000  000)

-6 for removing redundant clear commands

Try it online!

\$\endgroup\$
2
\$\begingroup\$

Sinclair ZX81/Timex TS1000/1500 BASIC, ~33 tokenized BASIC bytes for the listing

 LET A$="BASIC"
 1 FOR I=SGN PI TO LEN A$
 2 PRINT A$;
 3 NEXT I

Enter the language name into the var stack using direct mode to save one BASIC line, and save bytes in the listing itself. I assume the A$ variable is five bytes for the string and two bytes for the pointer, but I'm not 100% sure how the this works on the ZX81 - I will find out and update the byte count.

Sinclair ZX81/Timex TS1000/1500 BASIC (non-dynamic solution) ~21 tokenized BASIC bytes (symbolic listing)

 LET A$="BASIC"
 1 PRINT A$;A$;A$;A$;A$

Using the same technique as above, entering the A$ variable in direct mode and then simply printing the string five times. To run either solution, don't use the command RUN or the var stack is initialised. Use:

 GOTO 1
\$\endgroup\$
6
  • 1
    \$\begingroup\$ Save 5 bytes by using SGN PI instead of 1. And by my count the second one is only 36 bytes. \$\endgroup\$
    – Neil
    Commented Dec 18, 2017 at 11:23
  • \$\begingroup\$ Yes, I will optimise futher; also one could use INPUT A$ in line one, and will therefore work with any language inputted into the A$ string \$\endgroup\$ Commented Dec 18, 2017 at 11:25
  • \$\begingroup\$ @Neil - how are you counting 36 bytes in the second listing? \$\endgroup\$ Commented Dec 19, 2017 at 14:24
  • \$\begingroup\$ The first line is 4 bytes for the line number and length, 1 for the token, 10 normal bytes, 1 for the newline. The second is similar, except it has 14 normal bytes. I make that 36 bytes in total. \$\endgroup\$
    – Neil
    Commented Dec 19, 2017 at 16:43
  • \$\begingroup\$ It's a good job I put a ~ in front of my byte count isn't it. Somehow I mis-counted. Twice. But I'd rather work out proper byte counts on 8 bit machines, i.e., how much actual memories do my listings take? \$\endgroup\$ Commented Dec 19, 2017 at 17:21
2
\$\begingroup\$

Befunge-93, 27 Bytes

Edit: Much cleaner solution of the same length suggested by James Holderness

0"39-egnufeB">:#,_$1+:9`#@_

Try It Online

Old 30 byte version:

?
_g7-00p"39-egnufeB">:#,_g`#@

Try It Online

It feels weird to use the ? command for something that isn’t random, but that’s the only direction changing instruction that had an ASCII value low enough

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Surely it's easier to just keep the counter on the stack: Try it online! \$\endgroup\$ Commented Dec 20, 2017 at 15:25
  • \$\begingroup\$ @JamesHolderness Not if you're printing the "-93" as well. Then it's the same length (but still a much cleaner solution) \$\endgroup\$
    – Jo King
    Commented Dec 24, 2017 at 15:34
2
\$\begingroup\$

;#*, 420 bytes

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#

Try it online! (uses ;#+ instead)

\$\endgroup\$
4
  • \$\begingroup\$ You can golf this approach. \$\endgroup\$ Commented Dec 17, 2017 at 19:03
  • \$\begingroup\$ @ConorO'Brien Well I intended this to be a ;# answer but since that is not considered a language (it cannot perform a primality test), I used ;#+. Will look at the docs and see what I can do \$\endgroup\$
    – Mr. Xcoder
    Commented Dec 17, 2017 at 19:10
  • \$\begingroup\$ This is a kolgomorov complexity challenge, so primality testing isn't required. This can be a ;# answer if you still want to \$\endgroup\$ Commented Dec 25, 2017 at 1:20
  • \$\begingroup\$ @cairdcoinheringaahing Changed to ;#* \$\endgroup\$
    – Mr. Xcoder
    Commented Dec 25, 2017 at 6:23
2
\$\begingroup\$

Java 11, 19 bytes

v->"Java".repeat(4)

Try it online.

Java 8, 21 bytes

v->"JavaJavaJavaJava"

Well...

Try it here.

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

Pyth, 7 bytes

*4"Pyth

My first Pyth answer!

Thanks to Mr. Xcoder for a neat trick.

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ *4"Pyth for 7 bytes \$\endgroup\$
    – Mr. Xcoder
    Commented Dec 17, 2017 at 14:57
  • \$\begingroup\$ @Mr.Xcoder, neat! \$\endgroup\$
    – Daniel
    Commented Dec 17, 2017 at 14:58
1
\$\begingroup\$

Jelly, 7 bytes

“¢³ƒ»ẋ5

Try it online!

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

APL,  10 7 bytes

∊(⍴c)⍴⊂c←⎕

APL => APLAPLAPL

previous answer above prompted for screen input but if no input is required then we have the trivial for 7 bytes

9⍴'APL'
\$\endgroup\$
0
1
\$\begingroup\$

SNOBOL4 (CSNOBOL4), 30 bytes

 OUTPUT =DUPL('SNOBOL4',7)
END

Try it online!

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

Deorst, 11 bytes

'Deorst'l6*

Try it online!

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

PHP, 59 bytes

Not the best way to do it (and there's a better php solution), but here's my go at it:

<?php $s="php";$l=strlen($s);for($i=0;$i<$l;$i++){echo $s;}

Try it online!

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

rk, 22 bytes

rk:start
print: "rkrk"

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ Wait someone else knows about this language :o \$\endgroup\$
    – MD XF
    Commented Dec 17, 2017 at 23:51
1
\$\begingroup\$

Octave, 26 bytes

disp(repmat('Octave',1,6))

Try it online!

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

MY-BASIC, 33 bytes

for x=1 to 8
print"MY-BASIC"
next

Try it online!

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

05AB1E, 10 bytes

"05AB1E"6×

Try it online!

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

Befunge-98 (FBBI), 22 bytes

7v
"<_@#:-1,k6"Befunge

Try it online!

with -98 included:

av
"<_@#:-1,k9"Befunge-98

Try it online!

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

pl, 4 bytes

plpl

Try it online!

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

Cy, 12 bytes

"CyCy" print

Try it online!

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

Tcl, 14 bytes

puts TclTclTcl

Try it online!

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

Husk, 8 6 bytes

‼D¨Ż%k

-2 bytes thanks to @Zgarb!

Try it online or alternatively DD¨Ż%k would work too..

Explanation

‼D¨Ż%k
  ¨Ż%k  -- compressed string: "Husk"
‼D      -- duplicate twice: "HuskHuskHuskHusk"
\$\endgroup\$
1
  • 2
    \$\begingroup\$ ‼D works too. \$\endgroup\$
    – Zgarb
    Commented Dec 17, 2017 at 20:08

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