7
\$\begingroup\$

Using the word “conemon” print each character 2 times more than the last. The first letter, “c”, should be printed 10 times, the second 12 and so on. Each repeated-letter-string should be printed on a new line.

So the end-result becomes:

cccccccccc
oooooooooooo
nnnnnnnnnnnnnn
eeeeeeeeeeeeeeee
mmmmmmmmmmmmmmmmmm
oooooooooooooooooooo
nnnnnnnnnnnnnnnnnnnnnn
\$\endgroup\$
  • \$\begingroup\$ Cccccccccc Oooooooooooo Nnnnnnnnnnnnnn And so on the solution should be displaced like that. There should be new line after every character is printed n times \$\endgroup\$ – Monolica Oct 2 '18 at 10:11
  • 2
    \$\begingroup\$ Welcome to PPCG! I have update the challenge text to reflect your comment above (specifications should be in the post not in the comments). I also fixed up the grammar a little. Feel free to edit it more. \$\endgroup\$ – Jonathan Allan Oct 2 '18 at 10:17
  • \$\begingroup\$ The less characters the better. \$\endgroup\$ – Monolica Oct 2 '18 at 10:31
  • \$\begingroup\$ What is the smallest number of characters that could be used to solve this problem using python? \$\endgroup\$ – Monolica Oct 2 '18 at 13:14
  • 7
    \$\begingroup\$ Don't know if this is of use for anyone, but conemon is rot10(seduced). \$\endgroup\$ – user2390246 Oct 2 '18 at 13:35

44 Answers 44

1
\$\begingroup\$

Stax, 12 bytes

ü¡│\½◙S·«═▓╞

Run and debug it

Unpacked, ungolfed, and commented, it looks like this.

`Mwys-` compressed literal "conemon"
m       for each character output the result after running the rest of the program
 ]      wrap in singleton array
 iHA+   `2 * i + 10` where i is the 0-based iteration index
 *      repeat array

Run this one

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

Z80Golf, 35 31 bytes

00000000: 2118 0016 0a42 7efe 0028 0cff 10f8 3e0a  !....B~..(....>.
00000010: ff23 1414 4218 ef76 636f 6e65 6d6f 6e    .#..B..vconemon

Try it online!

Assembly:

ld hl,str
ld d, 10
ld b, d
loop:
	ld a,(hl)
	cp 0
	jr z, hlt
	rst 38h; putchar
	djnz loop
ld a, 10; newline
rst 38h
inc hl
inc d
inc d
ld b, d
jr loop
hlt:
	halt
str:
	db 'conemon'

-4 bytes changed call 8000h to rst 38h

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

[PHP], 76 bytes

$i=8;foreach(str_split("conemon") as $k){$i+=2;echo str_repeat($k,$i)."\n";}

Try it online

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

Z80Golf, 23 bytes

00000000: 0907 060d 0507 0676 1a3c 473c 127e ee68  .......v.<G<.~.h
00000010: ff10 fd3e 0a23 e5                        ...>.#.

Try it online!

Disassembly

start:
  add hl, bc ; db ('c'^$68)-2
  rlca       ; db 'o'^$68
  ld b, $0d  ; db 'n'^$68
             ; db 'e'^$68
  dec b      ; db 'm'^$68
  rlca       ; db 'o'^$68
  ld b, $76  ; db 'n'^$68
             ; halt

  ld a, (de) ; manipulate the byte at address 0
  inc a
  ld b, a    ; loop count
  inc a
  ld (de), a ; save +2 of previous

  ld a, (hl)
  xor $68    ; the char to print
loop:
  rst $38    ; print it `b` times
  djnz loop

  ld a, $0a  ; newline to print
  inc hl     ; string index & return address
  push hl

The Hello World trick strikes again. The first byte is also used to track the loop count.

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

GolfScript, 26 bytes

7:a;"conemon"{{.}a)):a*n}%

Try it online!

I'm surprised nobody else has done a solution in this language by now. However, I won't be surprised when this submission is eventually beaten.

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

APL(NARS), 19 chars, 38 bytes

⊃'conemon'/¨⍨2×4+⍳7

test:

  ⊃'conemon'/¨⍨2×4+⍳7
cccccccccc            
oooooooooooo          
nnnnnnnnnnnnnn        
eeeeeeeeeeeeeeee      
mmmmmmmmmmmmmmmmmm    
oooooooooooooooooooo  
nnnnnnnnnnnnnnnnnnnnnn
\$\endgroup\$
1
\$\begingroup\$

Perl 6, 36 34 bytes

-2 bytes thanks to nwellnhof

("conemon".comb Zx(5..*X*2))>>.say

Try it online!

Explanation:

 "conemon".comb                     # Get conemon as a list of characters
                   5..*             # A lazy list from 5 to infinity
                       X*2          # Multiplied by 2
                                    # This results in the list 10,12,14 etc.
                Zx                  # Zip the two together with the string multiplication operator
                                    # This multiplies each character by 10, 12 etc.
                            >>.say  # Print each line
\$\endgroup\$
  • \$\begingroup\$ Would you be able to explain your solution? \$\endgroup\$ – Monolica Oct 4 '18 at 11:08
  • \$\begingroup\$ @Monolica I've added an explanation \$\endgroup\$ – Jo King Oct 4 '18 at 11:29
1
\$\begingroup\$

Perl 5, 33 bytes

conemon=~s/./say$&x(8+2*++$i)/reg

Try it online!

Explanation

         s/ /                /     # Replace
                                g  # each
           .                       # character
       =~                          # in
conemon                            # string "conemon"
                              r    # non-destructively (source is read-only)
                               e   # only for the side effect of
             say                   # printing with newline
                $&                 # the full match (character)
                  x                # repeated
                        ++$i       # 1,2,3,...
                      2*           # 2,4,6,...
                    8+             # 10,12,14,...
                   (        )      # times
\$\endgroup\$
  • \$\begingroup\$ Can you explain your solution please? \$\endgroup\$ – Monolica Oct 4 '18 at 10:42
  • \$\begingroup\$ @Monolica Done. \$\endgroup\$ – nwellnhof Oct 4 '18 at 12:00
1
\$\begingroup\$

Japt, 17 bytes

"conemon"¬Ëp°EÑ+8

Try it online!


Japt, 14 bytes

`¬¶n`¬Ëp°EÑ+8

Try it online!


Explanation

"conemon"¬Ëp°EÑ+8           Full Program
"conemon"¬                  Split each letter       
          Ëp                Map and repeat  
            °EÑ+8           ((1 + Index) * 2) + 8
\$\endgroup\$
  • \$\begingroup\$ Looks like you beat me to it. You're welcome to this if you want it. \$\endgroup\$ – Shaggy Oct 2 '18 at 12:32
  • \$\begingroup\$ @Shaggy Nah, keep yours, It is better than mine jejeje. Btw, why the string compression worked for you? I used v2.0 \$\endgroup\$ – Luis felipe De jesus Munoz Oct 2 '18 at 12:37
  • \$\begingroup\$ Compressing it as a single string and trying to decompress it with backticks didn't work for me either but it did with O.d() - it happens sometimes. I ended up splitting it into co and nemon, compressing those strings individually and then recombining them. \$\endgroup\$ – Shaggy Oct 2 '18 at 12:54
  • \$\begingroup\$ I tweaked mine slightly to be a little less similar to yours. \$\endgroup\$ – Shaggy Oct 2 '18 at 18:05
1
\$\begingroup\$

JavaScript (Node.js), 56 bytes

[..."conemon"].map((e,i)=>console.log(e.repeat(i*2+10)))

Try it online!

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

PowerShell, 46 bytes

$i=8;'c','o','n','e','m','o','n'|%{$_*($i+=2)}

# $i=8;foreach($c in [char[]]'conemon'){[string]$c*($i+=2)}
\$\endgroup\$
1
\$\begingroup\$

///, 74 bytes

/E/eeee//M/mmm//N/nnnn//O/oooo//;/OOO
NNNnn/cccccccccc
;
EEEE
MMMMMM
OO;NN

Try it online!

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

Retina, 29 bytes

K`conemon
L$`.
$.(5*_$`)*2*$&

Try it online! Explanation:

K`conemon

Initialise the buffer with the text.

L$`.

Loop over each character and output each substituion on its own line.

$.(5*_$`)*2*$&

Repeat the match (5 + index) * 2 times.

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

LUA, 67 66 bytes

s="conemon"
l=10
for i in s:gmatch'.'do print(i.rep(i,l))l=l+2 end

Try it online.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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