[Question]
  [
Your task is to output a Magical 8 Trapezium:
```
        1 × 8 + 1 = 9
       12 × 8 + 2 = 98
      123 × 8 + 3 = 987
     1234 × 8 + 4 = 9876
    12345 × 8 + 5 = 98765
   123456 × 8 + 6 = 987654
  1234567 × 8 + 7 = 9876543
 12345678 × 8 + 8 = 98765432
123456789 × 8 + 9 = 987654321
```
* Output in your chosen language in the fewest bytes possible.
* Note the number of spaces at the start of each line to maintain the trapezium shape.
* Trailing spaces are allowed.
* You can use `×` or the letter x - whichever you prefer.
  
[Answer]
## Python 2, 59 bytes
```
a=i=1
exec"print'%9d x 8 +'%a,i,'=',a*8+i;i+=1;a=a*10+i;"*9
```
The numbers `a` and `i` the equation `a * 8 + i` are generated arithmetically. Each line, `i` is incremented, and `a` has the next digit appended via `a=a*10+i`. For example, if `a=12345, i=5`, then `i` becomes `6`, so the new `a` is `12345*10 + 6` which is `123456`.
Storing these as numbers rather than strings lets us compute the RHS as given by the equation `a*8+i`, which is shorter than string reversing.
[Answer]
# [V](https://github.com/DJMcMayhem/V), 37 bytes
```
i¸ 1 X 8 + 1 = 98ñYp|Eylp^Xf+$ylp
```
[Try it online!](http://v.tryitonline.net/#code=acK4IDEgWCA4ICsgMSA9IDkbOMOxWXB8RXlscAFeWGYrASR5bHAY&input=)
This contains unprintable, so here is a hexdump:
```
00000000: 69c2 b820 3120 5820 3820 2b20 3120 3d20  i.. 1 X 8 + 1 = 
00000010: 391b 38c3 b159 707c 4579 6c70 015e 5866  9.8..Yp|Eylp.^Xf
00000020: 2b01 2479 6c70 18                        +.$ylp.
```
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), ~~32~~ ~~31~~ ~~30~~ 28 bytes
Code:
```
TG9N-ð×NLJðN"x8+ÿ="€ðJžmN£J,
```
Uses the **CP-1252** encoding. [Try it online!](http://05ab1e.tryitonline.net/#code=VEc5Ti3DsMOXTkxKw7BOIng4K8O_PSLigqzDsErFvm1OwqNKLA&input=).
[Answer]
## PHP, ~~105~~ ~~89~~ ~~60~~ 57 bytes
my first golf try here (thanks to manatwork & user55641)
```
for(;$i++<9;)printf("%9s x 8 + $i = %s
",$s.=$i,$s*8+$i);
```
### 59
```
for(;$i++<9;)printf("%9s x 8 + $i = %s
",$s.=$i,$t.=10-$i);
```
### 89 (my own try)
```
for(;@++$i<=9;){printf("%9s x 8 + %s = %s\n",join(range(1,$i)),$i,join(range(9,10-$i)));}
```
### 105 (first)
```
for($j='123456789';@$j[$i++];){printf("%9s x 8 + %s = %s\n",substr($j,0,$i),$i,strrev(substr($j,-$i)));}
```
[Answer]
# Pyth, 32 bytes
```
VS9ss[*dK-9NSN" x 8 + "N" = "r9K
```
[Try it online!](http://pyth.herokuapp.com/?code=VS9ss%5B%2adK-9NSN%22+x+8+%2B+%22N%22+%3D+%22r9K&debug=0)
```
VS9ss[*dK-9NSN" x 8 + "N" = "r9K
VS9                                  # For N in 1..9
   s                                 # Join without delimiter
    s[                               # Reduce the array on + (flattens)
      *dK-9N                         # - Space, repeated K=(9-N) times
            SN                       # - The string sequence 1..N
              " x 8 + "              # - This string literal
                       N             # - N itself
                        " = "        # - This string literal
                             r9K     # - The string sequence 9..K
```
---
Thanks to @FryAmTheEggman for saving 2 bytes.
Thanks to @KennyLau for saving 3 bytes.
[Answer]
## CJam, ~~39~~ ~~38~~ 36 bytes
*Thanks to Optimizer for saving 2 bytes.*
```
9{)_,:)9Se[" x 8 + "@S'=S9_,fm4$<N}/
```
[Test it here.](http://cjam.aditsu.net/#code=9%7B)_%2C%3A)9Se%5B%22%20x%208%20%2B%20%22%40S'%3DS9_%2Cfm4%24%3CN%7D%2F)
Same byte count:
```
9{)_,:)9Se[]"x8+"+:\'=9_,f-Y$<]S*n}/
```
This requires the latest version, available on [Try it online!](http://cjam.tryitonline.net/#code=OXspXyw6KTlTZVtdIng4KyIrOlwnPTlfLGYtWSQ8XVMqbn0v&input=)
[Answer]
# Python 2, ~~87~~ ~~84~~ ~~78~~ 75 bytes
```
s="123456789"
n=1
exec'print"%9s"%s[:n],"x 8 + %s ="%n,s[::-1][:n];n+=1;'*9
```
[**Try it online**](http://ideone.com/nr9mEO)
A previous version uses some string magic.
```
R=range(1,10)
for n in R:print" "*(9-n)+`R`[1:n*3:3]+" x 8 + %d = "%n+`R`[-2:27-3*n:-3]
```
Casting `range(1,10)` to a string gives `[1, 2, 3, 4, 5, 6, 7, 8, 9]`, and this is nice since every number is only a single digit. So getting the string `123456789` from this is simple with ``range(1,10)`[1::3]`. The reversed range is  ``range(1,10)`[-2::-3]`. Then, to get only as far as I want each iteration, I slice it off at either `3*n`, or at `3*(9-n)` (`27-3*n`) for the reversed digits.
[Answer]
## Perl, 49 bytes
```
printf"%9s x 8 + $_ = %s
",$@.=$_,$_+8*$@for 1..9
```
### Usage
```
perl -e 'printf"%9s x 8 + $_ = %s
",$@.=$_,$_+8*$@for 1..9'
```
[Answer]
# Ruby, ~~77~~ ~~73~~ ~~65~~ 60 bytes
[Try it online~](https://repl.it/Cfhi/37)
Major revamps from @manatwork
Another overhaul from @xsot
```
a=i=0;9.times{puts"%9d x 8 + %d = %d"%[a=a*10+i+=1,i,a*8+i]}
```
[Answer]
# Java 10, ~~151~~ ~~133~~ ~~130~~ ~~129~~ ~~126~~ 110 bytes
```
v->{String p="\n",r="";for(int n=123456789,i=9;i>0;n/=10,p+=" ")r=p+n+" x 8 + "+i+" = "+(n*8+i--)+r;return r;}
```
[Try it online.](https://tio.run/##LY/LTsMwEEX3/Yorr2ychJZnKsv9A7pBYgMsXDdFLu7EcpwIVOXbgyOymbdG55zNYMrz8Xuy3nQdXoyj6wpwlJp4MrbBfm6B1xQdfcHyt9YdMQiVp@Mqhy6Z5Cz2IOhpKHfX5TJo9kGsiJoxdWojzx9BenN3//D49FxvC6e3yu3Wim71Zl0EqRmYiDpIkgw/qCHBpMu1zpnTTS1dWQoZVWxSHwlRjZOaAUJ/8Blg4RhmvEu24P8c758wYlH47VJzqdo@VSGvkidOleXUey8Wn3H6Aw)
**Explanation:**
```
v->{                   // Method with empty unused parameter and String return-type
  String p="\n",       //  Prefix-String, starting at a newline
         r="";         //  Result-String, starting empty
  for(int n=123456789, //  Multiply-number, starting at 123456789
      i=9;i>0          //  Loop `i` in the range [9, 0):
      ;                //    After every iteration:
       n/=10,          //     Remove the last digit from the integer
       p+=" ")         //     Append a space after the prefix
    r=...+r;           //   Prepend the following to the result-String:
      p                //    The prefix-String
      +n               //    Followed by the integer
      +" x 8 + "       //    Followed by the literal String " x 8 + "
      +i               //    Followed by the loop-index `i`
      +" = "           //    Followed by the literal String " = "
      +(n*8+i--)       //    Followed by the result of that equation
  return r;}           //  Return the result-String
```
[Answer]
## C#, 113 bytes
```
void f(){for(int n=1,i=1;i<10;n=10*n+ ++i)Console.WriteLine(new string(' ',9-i)+n+" x "+"8 + "+i+" = "+(n*8+i));}
```
if you have anyway to improve this solution feel free to share.
[Answer]
## Batch, 117 bytes
```
@echo off
set a=         12345678987654321
for /l %%i in (1,1,9)do call echo %%a:~%%i,9%% x 8 + %%i = %%a:~17,%%i%%
```
Yes, that is 16 % signs on one line; that's Batch for you!
[Answer]
## Haskell, 92 bytes
```
s=(show=<<)
[1..9]>>= \x->([x..8]>>" ")++s[1..x]++" x 8 + "++s[x]++" = "++s[9,8..10-x]++"\n"
```
How it works:
```
s=(show=<<)                   -- helper function that turns a list of numbers into
                              -- a string without delimiters, e.g. [1,2] -> "12"
[1..9]>>=                     -- for each number 1 to 9
     ([x..8]>>" ")            -- take length of [x..8] copies of a space
     s[1..x]                  -- the digits from 1 to x
     " x 8 + "                -- a string literal
     s[x]                     -- the digit of x
     " = "                    -- another string literal
     s[9,8..10-x]             -- the digits from 9 down to 10-x
     "\n"                     -- an a newline
```
[Answer]
## [Retina](https://github.com/m-ender/retina), 66 bytes
Byte count assumes ISO 8859-1 encoding. The leading linefeed is significant.
```
123456789!9 = 987654321
+`^((.)+)\B.!.(.+).
 $1!$2$3¶$&
!
 x 8 + 
```
[Try it online!](http://retina.tryitonline.net/#code=CjEyMzQ1Njc4OSE5ID0gOTg3NjU0MzIxCitgXigoLikrKVxCLiEuKC4rKS4KICQxISQyJDPCtiQmCiEKIHggOCArIA&input=)
[Answer]
## Pyke, ~~30~~ 29 bytes
```
9Fd*~utj+9<\x8\+9i-\=ji>_dJ)X
```
[Try it here!](http://pyke.catbus.co.uk/?code=9Fd%2a%7Eutj%2B9%3C%5Cx8%5C%2B9i-%5C%3Dji%3E_dJ%29X&warnings=0)
```
9F                         )  -  for i in range(9):
  d*                          -       " " * i
        +                     -      ^ + V
       j                      -       j = V
    ~ut                       -        "123456789"
         9<                   -     ^[:9]
           \x8\+9i-\=         -    [^, "x", 8, "+", (9-i), "=", V]
                        _     -     reversed(V)
                     ji>      -      j[i:]
                         dJ   -   " ".join(^)
                            X - print(reversed(^))
```
[Answer]
## PowerShell v2+, ~~85~~ ~~64~~ ~~58~~ ~~57~~ 52 bytes
```
8..0|%{" "*$_+-join(1..++$i+" x 8 + $i = "+9..++$_)}
```
Loops from 8 to 0 `8..0|%{...}` via the range operator. Each iteration, we output a string concatenation consisting of (the appropriate number of spaces `" "*$_`), plus a `-join`ed string of (a range from `1` to a pre-incremented helper number `++$i`, plus the middle bit `" x 8 + $i = "`, plus the final range from `9` to the current number `$_` pre-incremented).
One big trick here is we leverage the "left-preference" for typecasting, which allows us to "add" arrays together inside the `-join` parens, meaning we use only one `-join` operator.
### Example
```
PS C:\Tools\Scripts\golfing> .\magical-8-trapezium.ps1
        1 x 8 + 1 = 9
       12 x 8 + 2 = 98
      123 x 8 + 3 = 987
     1234 x 8 + 4 = 9876
    12345 x 8 + 5 = 98765
   123456 x 8 + 6 = 987654
  1234567 x 8 + 7 = 9876543
 12345678 x 8 + 8 = 98765432
123456789 x 8 + 9 = 987654321
```
[Answer]
# C, 74 bytes
```
d(i,n){for(i=n=1;i<10;n=++i+n*10)printf("%9d x 8 + %d = %d\n",n,i,n*8+i);}
```
[Answer]
# [MATL](https://github.com/lmendo/MATL), ~~38~~ ~~36~~ 35 bytes
```
9:"9@-Z"@:!V' x 8 + '@VO61O58@:-v!D
```
[**Try it online!**](http://matl.tryitonline.net/#code=OToiOUAtWiJAOiFWJyB4IDggKyAnQFZPNjFPNThAOi12IUQ&input=)
[Answer]
# J, 51 bytes
```
(|."1|.\p),.' x 8 + ',"1]p,.' = ',"1]\|.p=:u:49+i.9
```
Creates the string `123456789` and then operates on prefixes and suffixes of it to create the output.
### Usage
```
   (|."1|.\p),.' x 8 + ',"1]p,.' = ',"1]\|.p=:u:49+i.9
        1 x 8 + 1 = 9        
       12 x 8 + 2 = 98       
      123 x 8 + 3 = 987      
     1234 x 8 + 4 = 9876     
    12345 x 8 + 5 = 98765    
   123456 x 8 + 6 = 987654   
  1234567 x 8 + 7 = 9876543  
 12345678 x 8 + 8 = 98765432 
123456789 x 8 + 9 = 987654321
```
[Answer]
# JavaScript ES6 (88)
Taking advantage of the new `repeat` method, backticks and templating...
```
i=10;for(y="";--i;)console.log(`${" ".repeat(i)+(y+=(x=10-i))} x 8 + ${x} = ${y*8+x}\n`)
```
[Answer]
# R, ~~107~~ 103 bytes
```
a=1;for(i in 2:10){cat(rep("",11-i),paste(a,"x",8,"+",(i-1),"=",strtoi(a)*8+(i-1)),"\n");a=paste0(a,i)}
```
**Ungolfed :**
```
a=1
for(i in 2:10)
    cat(rep("",11-i),paste(a,"x",8,"+",(i-1),"=",strtoi(a)*8+(i-1)),"\n")
    a=paste0(a,i)
```
**Result :**
```
        1 x 8 + 1 = 9 
       12 x 8 + 2 = 98 
      123 x 8 + 3 = 987 
     1234 x 8 + 4 = 9876 
    12345 x 8 + 5 = 98765 
   123456 x 8 + 6 = 987654   
  1234567 x 8 + 7 = 9876543 
 12345678 x 8 + 8 = 98765432 
123456789 x 8 + 9 = 987654321
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~61~~ ~~52~~ 39 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")
```
↑(⍳9)((¯9↑↑),' x 8 +',⊣,'= ',↑∘⌽)¨⊂1↓⎕D
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT////1HbRI1HvZstNTU0Dq23BPKASFNHXaFCwUJBW13nUddiHXVbBSADKNMx41HPXs1DKx51NRk@apv8qG@qy///AA "APL (Dyalog Unicode) – Try It Online")
-9 bytes by using the `10⊥` trick to parse the number, instead of a reduction.
Thanks to @Adám for -13!
Explanation:
```
↑    ((¯9↑↑),' x 8 +',⊣,'= ',↑∘⌽)¨⊂1↓⎕D
                                     ⎕D  ⍝ Numbers from 0 to 9
                                   1↓    ⍝ Drop the 0
 (⍳9)(                          )¨⊂      ⍝ Do 9 times, N=current
                             ↑∘⌽         ⍝ Reverse the string (9..1) and cut off N elements
                      ⊣                  ⍝ N itself
      (   ↑)                             ⍝ Drop N elements off the 1..9 string...
      (¯9↑ )                             ⍝ ...then pad it back with spaces
            ,' x 8 +', ,'= ',            ⍝ Join with a few constant strings
↑                                        ⍝ Format
```
[Answer]
## JavaScript (ES6), 99 bytes
```
_=>[...Array(9)].map((n,i)=>`${n="        123456789".substr(i,9)} x 8 + ${++i} = ${n*8+i}`).join`\n`
_=>".........".replace(/./g,(n,i)=>`${n="        123456789".substr(i,9)} x 8 + ${++i) = ${n*8+i}\n`)
```
Where `\n` represents a literal newline character. The second version outputs a trailing newline. I came up with a formula for the numbers `('1'.repeat(9-i)+0+i)/9` but the padding was easier to do this way.
[Answer]
# [Brainfuck](http://esolangs.org/wiki/Brainfuck), 232 bytes
```
++++++++[->+>+>+++++[->+>+>+>+>+>+++<<<<<<]>->>+>++>+++<<<<<<<<]>++>+>>>+++>>>---<<<<<<[-[-<<+>>>>.<<]>+[-<+>>>>+.<<<]>.>>>>>.<<<<<.>>>.<<<.>.<.>>.<<.>>>>.<<<<.<<<<[->>>+>>>+<<<<<<]>>[-<<+>>>>>>.-<<<<]>[->>>-<<<<+>]<<<[->>>+<<<]>.>]
```
[Try it online!](https://copy.sh/brainfuck/?c=KysrKysrKytbLT4rPis-KysrKytbLT4rPis-Kz4rPis-KysrPDw8PDw8XT4tPj4rPisrPisrKzw8PDw8PDw8XT4rKz4rPj4-KysrPj4-LS0tPDw8PDw8Wy1bLTw8Kz4-Pj4uPDxdPitbLTwrPj4-PisuPDw8XT4uPj4-Pj4uPDw8PDwuPj4-Ljw8PC4-LjwuPj4uPDwuPj4-Pi48PDw8Ljw8PDxbLT4-Pis-Pj4rPDw8PDw8XT4-Wy08PCs-Pj4-Pj4uLTw8PDxdPlstPj4-LTw8PDwrPl08PDxbLT4-Pis8PDxdPi4-XQ$$)
Can be golfed much further...
[Answer]
## Javascript (using external library) (143 bytes)
```
n=>_.Range(1,9).WriteLine(v=>_.Range(0,10-v).Write("",x=>" ")+_.Range(1,v).Write("")+" x 8 + " + v + " = "+_.Range(10-v,v).Reverse().Write(""))
```
Link to lib: <https://github.com/mvegh1/Enumerable/>
Explanation of code: Create range 1 to 9, and for each value, write a line corresponding to the complex predicate. The predicate is passed the current integer value, and creates a range spanning 10-currentValue elements, in order to create that many spaces. Those spaces are concatenated with the formula part of the line, and then that is concatenated with the tailend of the range matching the number of elements as the frontend, in reverse order. 
Note: In the image, the first line is off by one space because the console added a quotation mark since the return value is a string. The actual value is formatted correctly
[![enter image description here](https://i.stack.imgur.com/DSvoW.png)](https://i.stack.imgur.com/DSvoW.png)
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 24 bytes
```
9Lε©LJ'x8'+®'=T®L-Jðý}.c
```
[Try it online!](https://tio.run/##ASgA1/8wNWFiMWX//zlMzrXCqUxKJ3g4JyvCric9VMKuTC1Kw7DDvX0uY/// "05AB1E – Try It Online")
Uses a newer version than the challenge, which is now allowed.
[Answer]
# [Canvas](https://github.com/dzaima/Canvas), 20 [bytes](https://github.com/dzaima/Canvas/blob/master/files/chartable.md)
```
９｛Ｒ⤢x∙8∙+¹=¹◂±ｍ） ＊］ｒ
```
[Try it here!](https://dzaima.github.io/Canvas/?u=JXVGRjE5JXVGRjVCJXVGRjMyJXUyOTIyeCV1MjIxOTgldTIyMTkrJUI5JTNEJUI5JXUyNUMyJUIxJXVGRjREJXVGRjA5JTIwJXVGRjBBJXVGRjNEJXVGRjUy,v=8)
[Answer]
# VBA (Excel), 51 bytes
Using Immediate Window
```
For z=1To 9:a=a &z:?Spc(9-z)a" x 8 +"z"="a*8+z:Next
```
[Answer]
# k (77 bytes)
Could probably be shortened a bit more
```
-1@'((|t)#\:" "),'(t#\:n),'" x 8 + ",/:n,'" = ",/:(t:"I"$'n)#\:|n:"123456789";
```
Example:
```
k)-1@'((|t)#\:" "),'(t#\:n),'" x 8 + ",/:n,'" = ",/:(t:"I"$'n)#\:|n:"123456789";
         1 x 8 + 1 = 9
        12 x 8 + 2 = 98
       123 x 8 + 3 = 987
      1234 x 8 + 4 = 9876
     12345 x 8 + 5 = 98765
    123456 x 8 + 6 = 987654
   1234567 x 8 + 7 = 9876543
  12345678 x 8 + 8 = 98765432
 123456789 x 8 + 9 = 987654321
```
[Answer]
# golflua, 56 characters
```
p=""~@i=1,9p=p..i; w(S.q("%9s x 8 + %d = "..p*8+i,p,i))$
```
Sample run:
```
bash-4.3$ golflua -e 'p=""~@i=1,9p=p..i; w(S.q("%9s x 8 + %d = "..p*8+i,p,i))$'
        1 x 8 + 1 = 9
       12 x 8 + 2 = 98
      123 x 8 + 3 = 987
     1234 x 8 + 4 = 9876
    12345 x 8 + 5 = 98765
   123456 x 8 + 6 = 987654
  1234567 x 8 + 7 = 9876543
 12345678 x 8 + 8 = 98765432
123456789 x 8 + 9 = 987654321
```
]