8 8's make 1000

Print the following output of a happy coincidence addition pattern:

   8
8
8
88
+888
----
1000


Rules:

• No leading spaces except the ones already present
• There can be a trailing newline
• + sign needs to be displayed
• Order of parcels needs to be the same

No winner. It is per language.

• So, what exactly do you want us to print? 1000? 8+8+8+88+888=1000? – Okx Nov 1 '17 at 17:33
• I think he wants the entire equation as-is. – Thomas Ward Nov 1 '17 at 17:35
• Ah, I got confused by the lack of the tag kolmogorov-complexity – Okx Nov 1 '17 at 17:43
• I downvoted this challenge for the following reason: The output is far too short (in my opinion) for a KC challenge, and doesn't have a great pattern either. This doesn't leave too much place for clever compression, and hardcoding is most likely the golfiest way to solve it (in most languages). – Mr. Xcoder Nov 1 '17 at 17:57
• I upvoted because with answers getting below the size of the plain output (34 bytes), there obviously are some "clever" ways. – Felix Palmen Nov 2 '17 at 9:59

PowerShell, 3433 31 bytes

,'   8'*3+"  88
+888"+'-'*4+1e3


Try it online!

Five bytes shorter than printing the string as-is, but still not very golfy. now getting to be golfy.

Constructs an array of 3x ' 8' (saving a byte), then array-concatenates the remaining items, with '-'*4 saving a byte. The other byte savings comes from using 1e3 in place of 1000.

• You can replace all + on line breaks. This will not change the length. Only for fun. – mazzy Aug 9 '18 at 7:48

Charcoal, 15 14 bytes

Ｇ↑↑↓↙³8←→⟦+⁴Ｉφ


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

Ｇ↑↑↓↙³          Draw a polygon implicitly closing the path
8         Filled with the string 8
←        Move left one character
+     Literal string +
⁴    Integer 4 (prints as ----)
φ  Predefined variable 1000
Ｉ   Cast to string
⟦      Wrap in array (implicit ⟧)
→       Override ← print direction
Implicitly print one per line


Bash, 35 bytes

printf %4s\\n {,,,8,+88}8 ---- 1000


Try It Online

Python 2, 40 bytes

print"   8\n"*3+"  88\n+888\n----\n1000"


Try it online!

• +2 bytes if you make it Python 3 compatible, but otherwise you're absolutely right. – Thomas Ward Nov 1 '17 at 17:56

Python 3, 575251 50 bytes

-5 bytes thanks to Mr. Xcoder.

-1 byte thanks to Dennis.

-1 byte again, thanks to Mr. Xcoder.

for i in 8,8,8,88,'+888','-'*4,1000:print('%4s'%i)


Try it online!

• Ahum Hardcoded output is 49 bytes.. – Kevin Cruijssen Nov 2 '17 at 8:55
• @KevinCruijssen Huh, that’s already my answer :-) – Mr. Xcoder Nov 2 '17 at 9:09
• @Mr.Xcoder Oh, oops.. Didn't notice there was another Python answer. Yours is even shorter by using print"..." instead of print('...'), though. :) I'll delete my comment above in that case. – Kevin Cruijssen Nov 2 '17 at 9:12
• @KevinCruijssen because that was already posted for Py2 I didn’t want to steal it ;) Besides, simply printing hard-coded is... boring? Almost like a cop-out so I didn’t take that approach :) – Thomas Ward Nov 2 '17 at 15:09
• @KevinCruijssen Keep in mind though that Python 2 and Python 3 are their own languages, in a sense, so there can be two different approaches :) – Thomas Ward Nov 2 '17 at 15:11

05AB1E, 20 bytes

-1 byte thanks to Riley

8ÐÐ«D„8+«'-4×₄R).Bí»


Try it online!

SOGL V0.12, 15 bytes

≥č*xi«∙tν↔β⁸‘4n


Try it Here! - simply  8 8 8 88+888----1000 compressed, then split to line lengths of 4

20 19 byte non-compression based method:

8³'E■888+⁰§o┌4*LM*⁰


Try it Here!

8                    push 8
³                   triplicate the 8
'E                 push 88
■888+            push "888+"
⁰           wrap those in an array
§          reverse horizontally, padding with spaces
o         output that
┌4*      push "-"*4
LM*   push 100*10
⁰  wrap those two in an array, outputting both


brainfuck, 107 bytes

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


Try it online!

Explanation

++++++++[>+++++>+>+++++++>++++<<<<-]>+++++>++<<+++
TAPE:
>V_LOOP< C_DASH C_NL C_EIGHT C_SPACE
003      045    010  056     032

~~~OUTPUT SECTION~~~
V_LOOP TIMES DO                     [-
PRINT C_SPACE x 3                 >>>> ...
PRINT C_EIGHT                     <.
PRINT C_NL                        <.
<<]
PRINT C_SPACE x 2                   >>>>..
PRINT C_EIGHT x 2                   <..
PRINT C_NL                          <.
C_DASH = C_DASH MINUS 2 (PLUS SIGN) <--
PRINT PLUS SIGN                     .
PRINT C_EIGHT x 3                   >>...
PRINT C_NL                          <.
PRINT C_DASH x 4                    <++....
PRINT C_EIGHT                       >.
C_DASH = C_DASH PLUS 2 ('1')        <++++
PRINT '1'                           .
C_DASH = C_DASH MINUS 1 ('0')       -
PRINT '0' x 3                       ...


Bubblegum, 23 bytes

00000000: 5350 50b0 e042 262c 2cb8 b42d 8084 2e10  SPP..B&,,..-....
00000010: 7019 1a18 1800 00                        p......


Try it online!

V, 23 bytes

3o³ 8òÙhr8òR1³0-Ò-kr+


Try it online!

Javascript 44 bytes

a=x=>   8
.repeat(3)+  88
+888
----
1000

console.log(a())

• 39 bytes – user72349 Nov 1 '17 at 19:25

s:$: 8:p;p a\ 88 a+888 a---- a1000  Try it online! I use the a command to append text lines to output. For comparison, the trivial solution is to print the hardcoded text like below, 42 bytes. Reduction is 11.9 %. c\ 8\n 8\n 8\n 88\n+888\n----\n1000  ///, 31 bytes /!/ 8 /!!! 88 +888 ---- 1000  Try it online! A measly 3 bytes savings. QBIC, 36 bytes ?@ 8?A?A?@ 88?@+888?@----?z^3  LOLCODE, 66 bytes HAI 1.3 VISIBLE " 8:) 8:) 8:) 88:)+888:)----:)1000" KTHXBYE  Try it online! R, 46 bytes41 bytes cat(' 8 8 8 88 +888 ---- 1000')  Try it online! Thanks to Dennis for golfing off 5 bytes. Java 8, 45 bytes v->" 8\n 8\n 8\n 88\n+888\n----\n1000"  Boring hard-coded output, but this can't be done any shorter in Java. Just utilizing the repeated part " 8\n" is already 52 bytes.. v->"aaa 88\n+888\n----\n1000".replace("a"," 8\n") Try it here. J, 28 27 bytes |.|:'1-+','0-88888'$~3,4,:7


Try it online!

                                             0-8
'0-88888'$~3,4,:7 Three rows: 0-88 0-88888 '1-+', "1-+" on top |.|: Rotate counter-clockwise  J, 37 bytes  7 4$'   8   8   8  88+888----1000'


Brainfuck, 104 bytes

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


Uses the same technique as this genius answer.

Tcl, 42 bytes

puts "   8
8
8
88
+888
----
1000"



Try it online!

Stax, 19 bytes

∩π╚nY╤¼æ♂ç♦d└tä♂&lò


Run and debug it

ASCII equivalent:

.-+]125E{'8*eN\$m+MrVk+m


Build the 8s together with the line below by transposing the string representation of the array [-8,-88,-88888].

Befunge-93, 66 bytes

"0001"25*"-":::25*"888+"25*"88  "25*"8 "::25*"8 "::25*"8 "::>:#,_@


Try it online!