Number Triangles

Mathematica, 104 97 90 94 bytes

{Grid[List@*Row/@#],#~Total~2}~Column~Right&[NestList[3-Mod[+##,3]&@@@Partition[#,2,1]&,#,9]]&

Explanation

Partition[#,2,1]

Partitions the input into length 2, offset 1 partitions.

3-Mod[+##,3]&@@@

Takes each partition, and calculates the corresponding output.

A trick involved here. I added up the two numbers, took mod 3, and subtracted that result from 3. That gives the desired number. (e.g. 3 - ((2 + 1) mod 3) = 3)

NestList[ ... ,9]

Repeats the above process nine times, giving all iterations as the output.

Grid[List@*Row/@#]

Format each iteration into rows, and put the entire thing in one column (center aligned), creating a triangle.

#~Total~2

Take the total of all numbers.

{...}~Column~Right

Combine the triangle and the total, and right align the entire thing (triangle is already aligned, so its alignment is not affected).


JavaScript (ES6), 143 142 bytes

Saved 1 byte thanks to @Neil

a=>a.map((_,i)=>(q=" ".repeat(i))+(a=a.map(c=>(x+=r=i&&p^(p=c)||c,r),p=i&&a.shift())).join` `+q,x=0).join`
`+`
`+(" ".repeat(18)+x).slice(-19)

I tried combining various parts, but it ended up 5 bytes longer:

a=>[...a.map((_,i)=>(a=a.map(c=>(x+=r=i&&p^(p=c)||c,r),p=i&&a.shift())).join` `+" ".repeat(i),x=0),x].map(q=>(" ".repeat(18)+q).slice(-19)).join`
`

Ruby, 134 101 bytes

Using JHM's modulo trick.

->a{b=*a
(0..8).map{|i|[" "*i,a=a.each_cons(2).map{|x,y|b<<n=3-(x+y)%3
n}]*" "}<<"%19d"%b.reduce(:+)}

See it on eval.in: https://eval.in/649993