text:
Build an Alphabet Pyramid
Today we're going to build a pyramid out of letters! Here's an example letter pyramid for the first 5 letters:

Write the first 5 letters with a space between, first ascending and then descending.
A B C D E D C B A

Do the same thing for the first four letters on the line above, but with two extra leading spaces:
  A B C D C B A
A B C D E D C B A

Repeat the same step until the last line is just 'A'
        A
      A B A
    A B C B A
  A B C D C B A
A B C D E D C B A

Repeat steps two and three going down instead of going up:
        A
      A B A
    A B C B A
  A B C D C B A
A B C D E D C B A
  A B C D C B A
    A B C B A
      A B A
        A

This same pattern can be extended up to 26 characters. Your challenge is to write a program or function that takes an integer as input, and produces the corresponding letter pyramid. You can choose to use uppercase or lowercase characters. You may always assume that the input will be an integer in [1, 26], and the output may be any reasonable format for a 2d string. For example, a string with newlines in it, an array of characters, printing to a file, etc. Each line may have trailing spaces on it, and you may optionally output one trailing newline.
Here are some example inputs/outputs:
1:

A

2:

  A
A B A
  A

3:

    A
  A B A
A B C B A
  A B A
    A

5:
        A
      A B A
    A B C B A
  A B C D C B A
A B C D E D C B A
  A B C D C B A
    A B C B A
      A B A
        A

13:

                        A
                      A B A
                    A B C B A
                  A B C D C B A
                A B C D E D C B A
              A B C D E F E D C B A
            A B C D E F G F E D C B A
          A B C D E F G H G F E D C B A
        A B C D E F G H I H G F E D C B A
      A B C D E F G H I J I H G F E D C B A
    A B C D E F G H I J K J I H G F E D C B A
  A B C D E F G H I J K L K J I H G F E D C B A
A B C D E F G H I J K L M L K J I H G F E D C B A
  A B C D E F G H I J K L K J I H G F E D C B A
    A B C D E F G H I J K J I H G F E D C B A
      A B C D E F G H I J I H G F E D C B A
        A B C D E F G H I H G F E D C B A
          A B C D E F G H G F E D C B A
            A B C D E F G F E D C B A
              A B C D E F E D C B A
                A B C D E D C B A
                  A B C D C B A
                    A B C B A
                      A B A
                        A

26:

                                                  A
                                                A B A
                                              A B C B A
                                            A B C D C B A
                                          A B C D E D C B A
                                        A B C D E F E D C B A
                                      A B C D E F G F E D C B A
                                    A B C D E F G H G F E D C B A
                                  A B C D E F G H I H G F E D C B A
                                A B C D E F G H I J I H G F E D C B A
                              A B C D E F G H I J K J I H G F E D C B A
                            A B C D E F G H I J K L K J I H G F E D C B A
                          A B C D E F G H I J K L M L K J I H G F E D C B A
                        A B C D E F G H I J K L M N M L K J I H G F E D C B A
                      A B C D E F G H I J K L M N O N M L K J I H G F E D C B A
                    A B C D E F G H I J K L M N O P O N M L K J I H G F E D C B A
                  A B C D E F G H I J K L M N O P Q P O N M L K J I H G F E D C B A
                A B C D E F G H I J K L M N O P Q R Q P O N M L K J I H G F E D C B A
              A B C D E F G H I J K L M N O P Q R S R Q P O N M L K J I H G F E D C B A
            A B C D E F G H I J K L M N O P Q R S T S R Q P O N M L K J I H G F E D C B A
          A B C D E F G H I J K L M N O P Q R S T U T S R Q P O N M L K J I H G F E D C B A
        A B C D E F G H I J K L M N O P Q R S T U V U T S R Q P O N M L K J I H G F E D C B A
      A B C D E F G H I J K L M N O P Q R S T U V W V U T S R Q P O N M L K J I H G F E D C B A
    A B C D E F G H I J K L M N O P Q R S T U V W X W V U T S R Q P O N M L K J I H G F E D C B A
  A B C D E F G H I J K L M N O P Q R S T U V W X Y X W V U T S R Q P O N M L K J I H G F E D C B A
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Y X W V U T S R Q P O N M L K J I H G F E D C B A
  A B C D E F G H I J K L M N O P Q R S T U V W X Y X W V U T S R Q P O N M L K J I H G F E D C B A
    A B C D E F G H I J K L M N O P Q R S T U V W X W V U T S R Q P O N M L K J I H G F E D C B A
      A B C D E F G H I J K L M N O P Q R S T U V W V U T S R Q P O N M L K J I H G F E D C B A
        A B C D E F G H I J K L M N O P Q R S T U V U T S R Q P O N M L K J I H G F E D C B A
          A B C D E F G H I J K L M N O P Q R S T U T S R Q P O N M L K J I H G F E D C B A
            A B C D E F G H I J K L M N O P Q R S T S R Q P O N M L K J I H G F E D C B A
              A B C D E F G H I J K L M N O P Q R S R Q P O N M L K J I H G F E D C B A
                A B C D E F G H I J K L M N O P Q R Q P O N M L K J I H G F E D C B A
                  A B C D E F G H I J K L M N O P Q P O N M L K J I H G F E D C B A
                    A B C D E F G H I J K L M N O P O N M L K J I H G F E D C B A
                      A B C D E F G H I J K L M N O N M L K J I H G F E D C B A
                        A B C D E F G H I J K L M N M L K J I H G F E D C B A
                          A B C D E F G H I J K L M L K J I H G F E D C B A
                            A B C D E F G H I J K L K J I H G F E D C B A
                              A B C D E F G H I J K J I H G F E D C B A
                                A B C D E F G H I J I H G F E D C B A
                                  A B C D E F G H I H G F E D C B A
                                    A B C D E F G H G F E D C B A
                                      A B C D E F G F E D C B A
                                        A B C D E F E D C B A
                                          A B C D E D C B A
                                            A B C D C B A
                                              A B C B A
                                                A B A
                                                  A

As always, this is code-golf so standard loopholes apply and the shortest answer in bytes wins!

Related - same challenge with slightly different chars, no spaces, no input

@stewiegriffin No, the spaces should be there either way.

Scrolling this page produces a neat optical illusion for the 26 output.

Python, 184 174 169 bytes
R=range
def g(a):
 def f(x,y,z):
  for i in R(x,y,z):print "  "*(i-1)," ".join([chr(65+j) for j in R((a-i))]+[chr(65+(a-i-2)-j) for j in R((a-i-1))])
 f(a,0,-1);f(2,a,1)

Edit: saved 5 bytes thanks to @nedla2004

I see a two things that can be changed.
1.) You can putg on three lines.
2.) Assign range to a variable.
You can see both of these here. (Note: Before def f(x,y,z): there is a space, before the for loop there is a tab.

Aren't there 3 ranges that you can replace?

You can save 4 bytes by turning R((a-i)) into R(a-i) and R((a-i-1)) into R(a-i-1), can't you?

There are 2 spaces that can be removed from before the for loops inside the list comprehension.

An useless whitespace after print.

146 bytes

05AB1E, 13 bytes
Code:
A.ps£û€û€S».c

Explanation:
A.p             # Push all prefixes of the alphabet.
   s£           # Only get the first input elements.
     û          # Palindromize, turns ['a', 'ab', 'abc'] -> ['a', 'ab', 'abc', 'ab', 'a']
      €û        # Palindromize each, turns ['a', 'ab', 'abc', 'ab', 'a']
                  into... ['a', 'aba', 'abcba', 'aba', 'a']
        €S      # Split each element.
          »     # Gridify, joins the arrays be newlines and the arrays in the arrays
                  by spaces.
           .c   # Centralize, aligning the text to the center.

Uses the CP-1252 encoding. Try it online!

So this is what "centralized" stands for in info.txt! Nice solution by the way.

@Osable Yep, it also works for strings with newlines in it (rather than only arrays).

MATL, 25 24 bytes
Zv&+64+G-t64>*1&!t0*hTec

Try it online!
Longer alternatives:

1Y20hiZv&+G-t0>*1&!t0*hTe) (26 bytes)
Zv&+64+G-t64>*l2&Y"tZyP:o*c (27 bytes)

Explanation
         % Implicit input
Zv       % Symmetric range. For input 3 it gives [1 2 3 2 1]
&+       % Matrix of all pairwise additions. For input 3 it gives a 5×5 matrix
64+G     % Add 64 and subtract input. This gives the desired ASCII codes in the
         % central rhombus
t64>*    % Make values less than 65 equal to 0. This affects entries outside the
         % central rhombus
1&!      % Permute second and third dimensions. Transforms the 5×5 matrix into
         % a 5×1×5 array
t0*      % Push a copy of that array with all entries equal to 0
h        % Concatenate along the second dimension. Gives a 5×2×5 array
Te       % Collapse the second and third dimensions. Gives a 5×10 matrix
c        % Convert to char. Char zero is displayed as space
         % Implicit display

V, 45 bytes
i¬A[À|lDybA"Ó./&
òÄó¨á© á úe±
>>.YGp{òd

Try it online!
This ended up being way less golfy than I had hoped, so I'm not going to post an explanation yet. Hopefully I can whittle it down some more first. As usual, here is a hexdump:
0000000: 69ac 415b 1bc0 7c6c 4479 6241 1f12 221b  i.A[..|lDybA..".
0000010: d32e 2f26 200a f2c4 f3a8 e1a9 20e1 20fa  ../& ....... . .
0000020: 65b1 200a 3e3e 2e59 4770 7bf2 64         e. .>>.YGp{.d

J, 34 bytes
(' ',u:65+i.26){~0>.]-[:+/~|@i:@<:

Takes the number as input and returns a 2D character array.
Explanation
(' ',u:65+i.26){~0>.]-[:+/~|@i:@<:  input y
                                <:  y - 1
                             i:     "steps" -- i:2 -> -2 1 0 1 2
                           |        absolute value
                        +/~         addition table
                      [:            join right two tines into a conjunction
                    ]-              y - this table
                 0>.                max(0, that)
(' ',u:65+i.26)                     the alphabet preceded by a space
               {~                   index

Decomposed test case
   n =: 5
   <: n
4
   i: <: n
_4 _3 _2 _1 0 1 2 3 4
   | i: <: n
4 3 2 1 0 1 2 3 4
   +/~ | i: <: n
8 7 6 5 4 5 6 7 8
7 6 5 4 3 4 5 6 7
6 5 4 3 2 3 4 5 6
5 4 3 2 1 2 3 4 5
4 3 2 1 0 1 2 3 4
5 4 3 2 1 2 3 4 5
6 5 4 3 2 3 4 5 6
7 6 5 4 3 4 5 6 7
8 7 6 5 4 5 6 7 8
   n - +/~ | i: <: n
_3 _2 _1 0 1 0 _1 _2 _3
_2 _1  0 1 2 1  0 _1 _2
_1  0  1 2 3 2  1  0 _1
 0  1  2 3 4 3  2  1  0
 1  2  3 4 5 4  3  2  1
 0  1  2 3 4 3  2  1  0
_1  0  1 2 3 2  1  0 _1
_2 _1  0 1 2 1  0 _1 _2
_3 _2 _1 0 1 0 _1 _2 _3
   0 >. n - +/~ | i: <: n
0 0 0 0 1 0 0 0 0
0 0 0 1 2 1 0 0 0
0 0 1 2 3 2 1 0 0
0 1 2 3 4 3 2 1 0
1 2 3 4 5 4 3 2 1
0 1 2 3 4 3 2 1 0
0 0 1 2 3 2 1 0 0
0 0 0 1 2 1 0 0 0
0 0 0 0 1 0 0 0 0
   u:65
A
   i.26
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
   65+i.26
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
   u:65+i.26
ABCDEFGHIJKLMNOPQRSTUVWXYZ
   ' ',u:65+i.26
 ABCDEFGHIJKLMNOPQRSTUVWXYZ
   (' ',u:65+i.26) {~ 0 >. n - +/~ | i: <: n
    A
   ABA
  ABCBA
 ABCDCBA
ABCDEDCBA
 ABCDCBA
  ABCBA
   ABA
    A

Let's try this with input 5.
Test cases
   f =: (' ',u:65+i.26){~0>.]-[:+/~|@i:@<:
   f 1
A
   f 2
 A
ABA
 A
   f 3
  A
 ABA
ABCBA
 ABA
  A
   f 4
   A
  ABA
 ABCBA
ABCDCBA
 ABCBA
  ABA
   A
   f 5
    A
   ABA
  ABCBA
 ABCDCBA
ABCDEDCBA
 ABCDCBA
  ABCBA
   ABA
    A
   f 26
                         A
                        ABA
                       ABCBA
                      ABCDCBA
                     ABCDEDCBA
                    ABCDEFEDCBA
                   ABCDEFGFEDCBA
                  ABCDEFGHGFEDCBA
                 ABCDEFGHIHGFEDCBA
                ABCDEFGHIJIHGFEDCBA
               ABCDEFGHIJKJIHGFEDCBA
              ABCDEFGHIJKLKJIHGFEDCBA
             ABCDEFGHIJKLMLKJIHGFEDCBA
            ABCDEFGHIJKLMNMLKJIHGFEDCBA
           ABCDEFGHIJKLMNONMLKJIHGFEDCBA
          ABCDEFGHIJKLMNOPONMLKJIHGFEDCBA
         ABCDEFGHIJKLMNOPQPONMLKJIHGFEDCBA
        ABCDEFGHIJKLMNOPQRQPONMLKJIHGFEDCBA
       ABCDEFGHIJKLMNOPQRSRQPONMLKJIHGFEDCBA
      ABCDEFGHIJKLMNOPQRSTSRQPONMLKJIHGFEDCBA
     ABCDEFGHIJKLMNOPQRSTUTSRQPONMLKJIHGFEDCBA
    ABCDEFGHIJKLMNOPQRSTUVUTSRQPONMLKJIHGFEDCBA
   ABCDEFGHIJKLMNOPQRSTUVWVUTSRQPONMLKJIHGFEDCBA
  ABCDEFGHIJKLMNOPQRSTUVWXWVUTSRQPONMLKJIHGFEDCBA
 ABCDEFGHIJKLMNOPQRSTUVWXYXWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWXYZYXWVUTSRQPONMLKJIHGFEDCBA
 ABCDEFGHIJKLMNOPQRSTUVWXYXWVUTSRQPONMLKJIHGFEDCBA
  ABCDEFGHIJKLMNOPQRSTUVWXWVUTSRQPONMLKJIHGFEDCBA
   ABCDEFGHIJKLMNOPQRSTUVWVUTSRQPONMLKJIHGFEDCBA
    ABCDEFGHIJKLMNOPQRSTUVUTSRQPONMLKJIHGFEDCBA
     ABCDEFGHIJKLMNOPQRSTUTSRQPONMLKJIHGFEDCBA
      ABCDEFGHIJKLMNOPQRSTSRQPONMLKJIHGFEDCBA
       ABCDEFGHIJKLMNOPQRSRQPONMLKJIHGFEDCBA
        ABCDEFGHIJKLMNOPQRQPONMLKJIHGFEDCBA
         ABCDEFGHIJKLMNOPQPONMLKJIHGFEDCBA
          ABCDEFGHIJKLMNOPONMLKJIHGFEDCBA
           ABCDEFGHIJKLMNONMLKJIHGFEDCBA
            ABCDEFGHIJKLMNMLKJIHGFEDCBA
             ABCDEFGHIJKLMLKJIHGFEDCBA
              ABCDEFGHIJKLKJIHGFEDCBA
               ABCDEFGHIJKJIHGFEDCBA
                ABCDEFGHIJIHGFEDCBA
                 ABCDEFGHIHGFEDCBA
                  ABCDEFGHGFEDCBA
                   ABCDEFGFEDCBA
                    ABCDEFEDCBA
                     ABCDEDCBA
                      ABCDCBA
                       ABCBA
                        ABA
                         A

Are you sure the lack if spaces in the output is OK? All other answers output this with spaces. I've asked just in case (since this would make it quite a bit easier in MATLAB too. :)

There seem to be some spaces missing

@DrMcMoylex I misread the challenge, I thought returning a 2D char array with the letters was sufficient. Working on a fix rn

Jelly, 13 bytes
RØAḣUz⁶ŒBṚŒḄG

TryItOnline!
How?
RØAḣUz⁶ŒBṚŒḄG - Main link: n         e.g. 3
R             - range                     [1,2,3]
 ØA           - uppercase alphabet yield  "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
   ḣ          - head                      ["A","AB","ABC"]
    U         - upend (vectorises)        ["A","BA","CBA"]
     z        - transpose with filler...
      ⁶       -     space character       ["ABC"," AB","  A"]
       ŒB     - bounce (vectorises)       ["ABCBA"," ABA ","  A  "]
         Ṛ    - reverse                   ["  A  "," ABA ","ABCBA"]
          ŒḄ  - bounce (flat)             ["  A  "," ABA ","ABCBA"," ABA ","  A  "]
            G - grid format (join each with spaces and join with line feeds)
                                              A
                                            A B A
                                          A B C B A
                                            A B A
                                              A

Python, 158 154 140 139 bytes
r=range
s=int(raw_input())
a=map(chr,range(65,91))
for i in r(0,s)+r(0,s-1)[::-1]:
 print (' '.join(a[:i+1]+a[:i][::-1])).center(s*4-2,' '))

This is my first post so be gentle! I made heavy use of [::-1] to reverse strings, so maybe there's some optimization to be had there. Comments welcome.
EDITS:
Thanks @Rod for the pointer to the helpful link to the Python code golf topic and also for reminding me that the letters need spaces between them. Also thanks @wec for the general tips about removing spaces.

You can remove spaces on either side of your operators (e. g. = becomes =), after commas, and before the opening parenthesis in the print statement. Python indentation can be any level as long as it's consistent, so you can save 3 characters by independenting your print statement only one space instead of four. Those are the easy savings I can see.

Welcome c: , we have this nice topic with lots of python tips (including a shorter alternative to generate the alphabet). Also since you are using z just one time, you don't need to use a variable, just put the s*2-1 directly in the center function. Just one detail, the output need to have spaces between the letters, a ' '.join right after the print should be enough (but you need to rework the s*2-1 to get the right value).

also, the default starting value for range and for [:] is 0, so you don need to put it explicitly

Pyke, 12 bytes
FhGR<Q{s
)OX

Try it here!
Disable warnings for specified output

C, 124 123 bytes
Saving 1 byte thanks to Mukul Kumar
Currently cant get my head to transform the double loop into a single one, will leave it like this for the moment. Actually, this is larger
for(l=0;l<4*n*(4*n+1);++l){
  i=l/(4*n+1)-2*n;
  j=l%(4*n+1)-2*n;

So i just let the nested loop.
i,j,k;f(n){for(i=-2*n-1;++i<2*n;){for(j=-2*n-1;++j<=2*n;k=abs(i/2)+abs(j/2),putchar(j-2*n?k>=n||i%2||j%2?32:65+n+~k:10));}}

Uses the Manhattan norm to get the diamond shape.
Ungolfed:
i,j,k;
f(n){
 for(i=-2*n-1;++i<2*n;){
  for(j=-2*n-1;++j<=2*n;
   k=abs(i/2)+abs(j/2),
   putchar(j-2*n?k>=n||i%2||j%2?32:65+n+~k:10)
  );
 }
}

You can reduce one byte by replacingj==2*n withj-2*n and exchanging the ? () values with :() value

C#, 266 263 262 261 245 238 235 232 bytes
Golfed:
List<string> F(int n){int i=0;var l=new List<string>();for(;i<n;i++){var h="";for(var c='A';c<'B'+i;c++)h+=" "+c;l.Add(new string(' ',(n-i+1)*2)+h+" "+string.Concat(h.Remove(i*2).Reverse()));}for(i-=2;i>=0;i--)l.Add(l[i]);return l;}

Ungolfed with comments:
    List<string> F(int n)
    {
        int i = 0;
        var l = new List<string>(); //collection of lines

        for (; i < n; i++)
        {
            var h = ""; //half of line

            //adding letters to first half of line
            for (var c = 'A'; c < 'B' + i; c++)
                h += " " + c;

            //adding leading spaces + half of line + reversed half of line to list
            l.Add(new string(' ', (n - i + 1)*2) + h + " " + string.Concat(h.Remove(i*2).Reverse()));
        }

        //adding lines in descending order
        for (i -= 2; i >= 0; i--)
            l.Add(l[i]);

        return l;
    }

Try it: http://rextester.com/WIL67940
Returns list of strings. Each string contains one output line.
I did that for fun and training. I realize that winning any of code-golf with C# is out of range.
EDIT1: Changed string interpolation to + operator.
EDIT2: c <= 'A' + i => c < 'B' + i
EDIT3: Swapped char with var.
EDIT4: Changed return type from void to List.
EDIT5: Removal of unnecessary variable.
EDIT6: New way of separating line halves.
EDIT7: @Kaspar Kjeldsen, thank you.

You can shave off a character by replacing string h=""; with var h="";

@KasparKjeldsen I can't believe I omited that.

Can get shorter still! http://rextester.com/JLUL92950
string[] F(int n){int i=0;var q=2*n-1;var l=new string[q];for(;i<n;i++){var h="";for(var c='A';c<'B'+i;c++)h+=" "+c;l[q-i-1]=l[i]=new string(' ',(n-i+1)2)+h+ " "+string.Concat(h.Remove(i2).Reverse());}return l;}

Brain-Flak, 630 + 3 = 633 bytes
This requires the -A flag to run
Try it Online
(({})){(({}[()])<({}<({}<>)><>)<>(({}<>)<(({}[({})()])<{({}[()]<({}<(((((()()()()){}){}){}))>)>)}{}(({}<((((((()()()()){}){}){}){}()<>)<>)>)<{({}[()]<((()({}<(((((()()()()){}){}){}<>)<>)>)<>)<>)>)}{}({}<(((((()()()()){}){}){}<>)<>)>)((((()()()()){}){}){})>){(({})[()]<(({}((((()()()()){}){}){}){}<>)<>)(((((()()()()){}){}){}<>)<>)>)}{}>){({}[()]<<>(((((()()()()){}){}){}))<>>)}{}(((()()()()()){}<>)<>)>)>)}{}{}{}([]){((({}[()])<{({}[()]<({}<({}<>)<>>)>)}{}>)<{({}[()]<<>({}<>)>)}{}>)}{}((()()()()()){})<>{}([]){((({}[()])<{({}[()]<({}<({}<>)<>>)>)}{}>)<{({}[()]<<>({}<>)>)}{}>)}{}{{}({}[(()()()()()){}])}{}([]){{}({}<>)<>([])}{}<>

This is not a great golf but this challenge is quite difficult in Brain-Flak

Pyth, 23 bytes
V+SQt_SQp*dy-QNt_pjd<GN

Try it online

Ruby, 137 115 100 84 bytes
->n{e=->s{s+s.reverse[1..-1]};e[(0..n-1).map{|i|"  "*(n-i)+e[[*?A..?Z][0..i]*' ']}]}

Thanks to manatwork for the comments.

Nice first answer. For ways to improve it, take a look at Tips for golfing in Ruby. First of all, kernigh's tip regarding functions. BTW, 0..n-1 → 0...n.

If you reverse the ternary logic you can use a single character relational operator: n>0?…:"".

“Your challenge is to write a program or function”. Better make it an anonymous lambda – that can take its parameter directly as integer.

TSQL, 261 236 bytes
DECLARE @i INT =5;

WITH C as(SELECT number z,abs(@i+~number)f
FROM spt_values WHERE'P'=type)SELECT
top(@i*2-1)space(f*2)+v+stuff(reverse(v),1,3,'')FROM(SELECT*,(SELECT
top(@i-f)char(65+z)+' 'FROM c
for xml path(''),type).value('.','varchar(52)')v FROM c)d

Fiddle

Befunge 93, 175 bytes
Try it online!
Probably not very well golfed. Oh well. This was hard enough with befunge:
&:00p"B"\- :13v
v,: _v#`"@"<p5<
v," "<v`+*9<
>" ",: 35g7^
v47"v"_>1+ v
>p#  0^:>- v
v"A"g53<1v<
>+00g-` |53
v">",+91<p+
>74p35g:v11
_v# -g00<+^ _@#:
1>59*:91v> v
^p+199p8>#+ <

Good luck figuring out how it works! I barely know.

Nice use of a run-time code modification.

C#, 199 bytes
q=>{Action<int>L=x=>{var s="";var k=0;for(;k<x;)s+=(char)('A'+k++)+" ";for(--k;--k>=0;)s+=(char)('A'+k)+" ";Console.WriteLine(new string(' ',(q-x)*2)+s);};var i=0;for(;i<q;)L(++i);for(;i>1;)L(--i);};

As always, C# is not much of a golfing language, but I prefer "readable" code much more than esoteric Code. Also I just did this for fun :)
Here's an ungolfed version, so you can easily understand what I did:
Action<int> C = q =>
{
    Action<int> L = x =>
    {
        var s = "";
        var k = 0;
        for (; k < x;)
            s += (char)('A' + k++) + " ";
        for (--k; --k >= 0;)
            s += (char)('A' + k) + " ";
        Console.WriteLine(new string(' ', (q - x) * 2) + s);
    };
    var i = 0;
    for (; i < q;)
        L(++i);
    for (; i > 1;)
        L(--i);
};

(I think this could be optimized a lot though..)

Java, 213 bytes
void p(int n){int i=1,s=1,f,c;while(i>0){f=(n+1-i)*2;System.out.printf("%"+f+"s","");c=65;for(;c<64+i;)System.out.printf("%c ",c++);for(;c>64;)System.out.printf("%c ",c--);System.out.println();if(i==n)s=-1;i+=s;}}

Ungolfed:
void p(int n) {
    int i = 1, s = 1, f, c;
    while (i > 0) {
        f = (n + 1 - i) * 2;
        System.out.printf("%" + f + "s", "");
        c = 65;
        for (; c < 64 + i; ) System.out.printf("%c ", c++);
        for (; c > 64; ) System.out.printf("%c ", c--);
        System.out.println();
        if (i == n) s = -1;
        i += s;
    }
}

Batch, 269 bytes
@echo off
set/an=%1-1
set a=ABCDEFGHIJKLMNOPQRSTUVWXYZ
for /l %%i in (-%n%,1,%n%)do set i=%%i&call:l
exit/b
:l
set s=
for /l %%j in (-%n%,1,%n%)do set j=%%j&call:c
echo%s%
exit/b
:c
set/aj=n-%i:-=%-%j:-=%
call set s= %%a:~%j%,1%%%s%

Line 2 ends in 25 spaces; this means that when the alphabet index goes negative those squares simply remain blank.

Java, 394 Bytes
I normally do C#, but it's good to mix it up...
Golfed:
String P(int n){String a="ABCDEFGHIJKLMNOPQRSTUVWXYZ",o="",k="",s="";int i=0,j=0,l=0;java.util.List<String>b=new java.util.ArrayList<String>();for(i=1;i<=n;i++){k="";s=a.substring(0,i);l=s.length();for(j=0;j<l;j++)k+=s.toCharArray()[j]+" ";while(k.length()<n+n)k=" "+k;if(i>1)for(j=l-2;j>=0;j--)k+=s.toCharArray()[j]+" ";k+="\r\n";b.add(k);o+=k;}for(i=b.size()-2;i>=0;i--)o+=b.get(i);return o;}

Ungolfed:
public String P(int n)
{
    String a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", o ="", k="",s="";
    int i =0, j=0, l=0;
    java.util.List<String> b = new java.util.ArrayList<String>();
    for (i = 1; i <= n; i++) {
        k = "";
        s = a.substring(0, i);
        l = s.length();

        for (j = 0; j < l; j++)
            k += s.toCharArray()[j] + " ";

        while(k.length() < n + n)
            k= " " + k;

        if(i > 1)
            for (j = l-2; j >= 0; j--)
                k += s.toCharArray()[j] + " ";

        k += "\r\n";
        b.add(k);
        o += k;
     }

    for (i = b.size()-2; i >= 0; i--)
        o += b.get(i);

    return o;
}

Test:
BuildAnAlphabetPyramid b = new BuildAnAlphabetPyramid();
System.out.println(b.P(5));
System.out.println(b.P(26));

        A
      A B A
    A B C B A
  A B C D C B A
A B C D E D C B A
  A B C D C B A
    A B C B A
      A B A
        A

                                                  A
                                                A B A
                                              A B C B A
                                            A B C D C B A
                                          A B C D E D C B A
                                        A B C D E F E D C B A
                                      A B C D E F G F E D C B A
                                    A B C D E F G H G F E D C B A
                                  A B C D E F G H I H G F E D C B A
                                A B C D E F G H I J I H G F E D C B A
                              A B C D E F G H I J K J I H G F E D C B A
                            A B C D E F G H I J K L K J I H G F E D C B A
                          A B C D E F G H I J K L M L K J I H G F E D C B A
                        A B C D E F G H I J K L M N M L K J I H G F E D C B A
                      A B C D E F G H I J K L M N O N M L K J I H G F E D C B A
                    A B C D E F G H I J K L M N O P O N M L K J I H G F E D C B A
                  A B C D E F G H I J K L M N O P Q P O N M L K J I H G F E D C B A
                A B C D E F G H I J K L M N O P Q R Q P O N M L K J I H G F E D C B A
              A B C D E F G H I J K L M N O P Q R S R Q P O N M L K J I H G F E D C B A
            A B C D E F G H I J K L M N O P Q R S T S R Q P O N M L K J I H G F E D C B A
          A B C D E F G H I J K L M N O P Q R S T U T S R Q P O N M L K J I H G F E D C B A
        A B C D E F G H I J K L M N O P Q R S T U V U T S R Q P O N M L K J I H G F E D C B A
      A B C D E F G H I J K L M N O P Q R S T U V W V U T S R Q P O N M L K J I H G F E D C B A
    A B C D E F G H I J K L M N O P Q R S T U V W X W V U T S R Q P O N M L K J I H G F E D C B A
  A B C D E F G H I J K L M N O P Q R S T U V W X Y X W V U T S R Q P O N M L K J I H G F E D C B A
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Y X W V U T S R Q P O N M L K J I H G F E D C B A
  A B C D E F G H I J K L M N O P Q R S T U V W X Y X W V U T S R Q P O N M L K J I H G F E D C B A
    A B C D E F G H I J K L M N O P Q R S T U V W X W V U T S R Q P O N M L K J I H G F E D C B A
      A B C D E F G H I J K L M N O P Q R S T U V W V U T S R Q P O N M L K J I H G F E D C B A
        A B C D E F G H I J K L M N O P Q R S T U V U T S R Q P O N M L K J I H G F E D C B A
          A B C D E F G H I J K L M N O P Q R S T U T S R Q P O N M L K J I H G F E D C B A
            A B C D E F G H I J K L M N O P Q R S T S R Q P O N M L K J I H G F E D C B A
              A B C D E F G H I J K L M N O P Q R S R Q P O N M L K J I H G F E D C B A
                A B C D E F G H I J K L M N O P Q R Q P O N M L K J I H G F E D C B A
                  A B C D E F G H I J K L M N O P Q P O N M L K J I H G F E D C B A
                    A B C D E F G H I J K L M N O P O N M L K J I H G F E D C B A
                      A B C D E F G H I J K L M N O N M L K J I H G F E D C B A
                        A B C D E F G H I J K L M N M L K J I H G F E D C B A
                          A B C D E F G H I J K L M L K J I H G F E D C B A
                            A B C D E F G H I J K L K J I H G F E D C B A
                              A B C D E F G H I J K J I H G F E D C B A
                                A B C D E F G H I J I H G F E D C B A
                                  A B C D E F G H I H G F E D C B A
                                    A B C D E F G H G F E D C B A
                                      A B C D E F G F E D C B A
                                        A B C D E F E D C B A
                                          A B C D E D C B A
                                            A B C D C B A
                                              A B C B A
                                                A B A
                                                  A

R, 100 97 87 bytes
x=scan();z=LETTERS;for(i in c(1:x,x:2-1))cat(rep(" ",x-i+1),z[1:i],if(i>1)z[i:2-1],"\n")

4:
#>         A
#>       A B A
#>     A B C B A
#>   A B C D C B A
#>     A B C B A
#>       A B A
#>         A

( Update: scan() for input; abused (x-1):1 == x:2-1. )
Not too shabby for one of the keyword languages by the looks of it (those special-character ones are always going to be better).

PHP, 122 116 bytes
for($i=1-$n=$argv[1];$i<$n;)echo str_pad("",$a=abs($i++)),$s=join(range(A,chr(64+$n-$a))),substr(strrev($s),1),"\n";

is there a shorter way?

JavaScript (ES6), 121 bytes
n=>[...Array(n+n--)].map((_,i,a)=>a.map((_,j)=>(j=10+n-g(i)-g(j))>9?(10-j).toString(36):` `,g=i=>i<n?n-i:i-n).join` `).join`\n`

Where \n represents the literal newline character. Outputs in lower case.

Perl 5 + -pa -M5.10.0, 79 bytes
@A=A..Z;$\=$s.$/.$\,say$s="  "x--$F[0]."@A[0..--$_,reverse 0..--$_]"for 1..$_}{
Try it online!

Perl 5 + -pl, 88 bytes
A slightly longer approach, but utilises ANSI escape codes and draws the letters in a spiral, starting with 9 o'clock, moving clockwise.
$l=A;$\x=($_-1);//,(map$\.="$l$_"x$',".[A ",". ","....","..[A.."),$\.=$l++.$"while$_--}{
Try it online!

Canvas, 8 bytes
Ｚｍ［］／ ＊┼

Try it here!
Explanation:
Zm[]/ *+ | Full code (chars replaced with ASCII alternatives for monospace)
---------+---------------------------------------------------------------------
Z        | Push uppercase alphabet
 m       | Mold to length (i.e. first <input> chars)
  []     | Prefixes
    /    | Antidiagonal (put spaces before each line/entry)
     _*  | Put a space between each character (space underlined for visibility)
       + | Quad-palindromize with 1 overlap

Vyxal C, 8 bytes
kA¦Ẏ∞ʁvṄ

Try it Online!
How?
kA¦Ẏ∞ʁvṄ
kA       # Push the uppercase alphabet
  ¦      # Prefixes
   Ẏ     # Get the first input items
    ∞    # Palindromise this list
     ʁ   # Palindromise each in this list
      vṄ # Join each on spaces
         # C flag centers and joins on newlines


text:
Abstract Syntax Tree Golfing: FizzBuzz, Python
Summary
Implement FizzBuzz in Python, with the fewest possible tokens.
Challenge
Write a program that prints the decimal numbers from 1 to 100 inclusive. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”. Programs must be written in some version of Python.
For more details, see 1, 2, Fizz, 4, Buzz
Scoring
Your score will be equal to the number of nodes in the abstract syntax tree of your code, as reported by this program for Python 3, or this program for Python 2. To run the programs, provide the filename of your code as  command line argument to the program. For instance:
python simple_counter.py fizzbuzz.py

These programs are based off of Python's ast module. If you have any difficulty, let me know.
To prevent trivial solutions, such as executing a long string with the actual program, or hardcoding the output, there are some additional restrictions:

No token in your code may be longer than 15 characters. The above programs will check this requirement for you. Note that for ease of implementation, the above programs count comments as tokens.
Code execution/evaluation is banned.

If you have questions as to whether something is allowed, ask me.
Scoring Heuristics
The following rules are typically enough to calculate the score of your program:

Block statements are 1 points: if, for ... in ..., while, else, etc.
Standalone statements are 1 point: print in Python 2, break, pass, etc.
Variables are 2 points
Single-token literals are 1 point: 2131, "Hello, world!", True
Functions are 3 points (2 for using a variable, 1 extra): print in Python 3, range, etc.
Operators are 2 points: +, *, %, and, not, etc.
= is 1 point
Augmented assignment is 2 points: +=, |=, etc.
Parentheses, indentation, etc. are 0 points.
A line containing an expression, as opposed to an assignment or an expression, is + 1 point.
Having code at all is 1 point.

Challenge:
The lowest score wins. Good luck!

I like this style. You have to go for simple programs rather than just short ones.

Do we really need [tag:code-challenge] [tag:ast-golf] for this? Isn't this just a specific form of [tag:atomic-code-golf]?

@MartinEnder The reason I did it this way is because the tag text for atomic-code-golf says "Atomic code golf is scored by the number of tokens of your program," and that's not the same as this, though perhaps only a pretty small amount.

33
Python 2
for i in range(1,101):print[i,'Fizz','Buzz','FizzBuzz'][int(`300102100120100`[i%15])]

46
for x in range(100):print('Fizz'*(x%3>1)+'Buzz'*(x%5>3)or str(x+1))

Can't x+1 not be stringified in python 3?

@DestructibleWatermelon Python 3 doesn't have backticks for repr as far as I remember.

Print can take an integer as its argument, was my point

39 34
for i in range(1,101):print [i,'Fizz','Buzz','FizzBuzz'][19142723>>2*(i%15)&3]

Python 3, 35
for x in range(1,101): print(('' if x%3 else 'Fizz') + ('' if x%5 else 'Buzz') or x)

Python 2, 36
for i in range(1, 101):
    print (not i % 3) * "Fizz" + (not i % 5) * "Buzz" or i

I think this is the shortest of the approaches that don't use large numbers / strings.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Get a word's individuality!
I love /usr/share/dict/words; it's so handy! I use it for all my programs, whenever I can! You're going to take advantage of this ever so useful file to use, by testing a word's individuality.

Input

A word; defined in this challenge as any string of characters
/usr/share/dict/words in some format; you may hard code it, read from disk, assume it as a second argument, whatever makes the most sense in your challenge

Output

A words individuality (see below)

A word's individuality is derived from the following equation:
<the number of words for which it is a substring> / <length of the word>

Let's take a look at an example:
hello. There are 12 words which have the substring hello in them, divided by 5 (hello's length), and hello's individuality is 12/5 or 2.4

P.S. This is codegolf, so the lower the individuality score, the more individual
Because individuality is a long word, your program must be as short as possible
Good Luck!

Test Cases
You can use this convenient Node.js script, which fits the challenge requirements to fit your code. It is also how I generated the test cases:
var fs = require("fs");
var word = process.argv[2];

process.stdout.write("Reading file...")
fs.readFile("/usr/share/dict/words", function(err, contents) {
  console.log("Done")
  if (err) throw err;

  words = contents.toString().split("\n");

  var substrings = words.filter(w => w.indexOf(word) > -1).length;
  var length     = word.length;

  console.log(`${word} => ${substrings} / ${length} = ${substrings / length}`)
})

Test Cases:
hello => 12 / 5 = 2.4
individuality => 1 / 13 = 0.07692307692307693
redic => 52 / 5 = 10.4
ulous => 200 / 5 = 40
challen => 15 / 7 = 2.142857142857143
ges => 293 / 3 = 97.66666666666667
hidden => 9 / 6 = 1.5
words => 12 / 5 = 2.4
aside => 8 / 5 = 1.6

Shouldn't it be the other way around?  To make it more individual, have a higher individuality score?

Probably, but making breaking changes to the challenge when people may have started golfing would be unwise

Can we use other word lists instead? I think this one is easier to use (being a Windows user). The list is apparently not as long, so the individuality will be higher, but this doesn't alter the challenge the way I see it.

Is a word a substring of itself?

I assume a case-insensitive match ?

In order to keep answers uniform, I request you use the same word list, but keep in mind that you can accept it in any way. Getting the word list is not part of the challenge

@Flp.Tkc Yes, basically anything that can be grepped

@zeppelin in most wordlists, all the entries are lowercase. Additionally you can assume that all input will be lowercase

@MayorMonty
Ok, great, I've asked as the /dict/words is not lowercase (at least not in my system).

05AB1E, 9 bytes
#vy²å}ON/

Try it online!
#         Separate by newlines or spaces.
 vy       For each entry in the dictionary.
   ²å     1 if the second argument is a substring of the current word, 0 o.w.
     }    End loop.
      O   Sum ones and zeros.
       N  Get list size.
        / Divide.

Looks like yours is going to be the shortest, but I'll give it a week or two

Bash, 41, 39, 34, 33, 26 bytes
EDIT:

Converted from function to a script
One byte off by removing the ignore case flag
Replaced wc -l with grep -c, saving 5 bytes. Thanks @Riley !

A rather trivial solution in bash + coreutils
Golfed
bc -l<<<`grep -c $1`/${#1}

Test
>cat /usr/share/dict/words| ./test ulous
7.60000000000000000000

>grep -i ulous /usr/share/dict/words | wc -l
38

Would grep -ic $1 work instead of grep -i $1|wc -l?

True ! (always thought this to be a GNU extension, but it turns out to be a POSIX option indeed). Thank you !

Python 3, 52 49 bytes
-3 bytes thanks to Kade, for assuming w to be the word list as list:
f=lambda s,w:w>[]and(s in w[0])/len(s)+f(s,w[1:])

Previous solution:
lambda s,w:sum(s in x for x in w.split('\n'))/len(s)

Assumes w to be the word list. I choose Python 3 because in my word list there are some Non-ASCII chars and Python 2 does not like them.

Since you are allowed to take the wordlist in any reasonable format, couldn't this work for 50 bytes: f=lambda s,w:w>[]and (s in w[0])/len(s)+f(s,w[1:])

I should note you can remove the space between and and ( to make it 49 bytes.

@Kade awesome! Nice abuse of the lax requirements.

@Dopapp No, because this would not substring

Perl 6,  45 36 33  32 bytes
wordlist as a filename f, 45 bytes
->$w,\f{grep({/:i"$w"/},f.IO.words)/$w.chars}

wordlist as a list l, 36 bytes
->$w,\l{grep({/:i"$w"/},l)/$w.chars}

using placeholder variables, and reverse (R) meta-operator, 33 bytes
{$^w.chars R/grep {/:i"$w"/},$^z}

using .comb to get a list of characters, rather than .chars to get a count, 32 bytes
{$^w.comb R/grep {/:i"$w"/},$^z}

Expanded:
{             # block lambda with placeholder parameters ｢$w｣ ｢$z｣

  $^w         # declare first parameter ( word to search for )
  .comb       # list of characters ( turns into count in numeric context )

  R[/]        # division operator with parameters reversed

  grep        # list the values that match ( turns into count in numeric context )

    {         # lambda with implicit parameter ｢$_｣
      /       # match against ｢$_｣
        :i    # ignorecase
        "$w"  # the word as a simple string
      /
    },

    $^z       # declare the wordlist to search through
              #( using a later letter in the alphabet
              #  so it is the second argument )
}

awk: 31 bytes
Passing the word as the w variable to the awk command, and the file in <stdin>:
$0~w{N++}END{print N/length(w)}

Sample output:
 $ awk -vw=hello '$0~w{N++}END{print N/length(w)}' /usr/share/dict/words
 2.4

PHP, 54 bytes
Assumes the word list in $w.
<?=count(preg_grep("/$argv[1]/",$w))/strlen($argv[1]);

Clojure, 53 bytes
Not that exciting :/
#(/(count(filter(fn[w](.contains w %))W))(count %)1.)

That 1. is there to convert a rational into a float. I pre-loaded words into W as such:
(def W (map clojure.string/lower-case (clojure.string/split (slurp "/usr/share/dict/words") #"\n")))

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Group these cells!
This challenge is based on the game Layerz.
Given, on stdin or as a function argument, a 2D rectangular array of cells where each cell contains either a blank (you may choose to use 0s instead of blanks at no penalty), a 1, a 2, a 3, or a 4; find a way to divide it into valid regions (as defined below) such that each non-blank cell is contained by exactly one  region. Then, output the solution found in any reasonable format. If there is no solution, either halt without producing output or output a single falsey value then halt.
Any of the following constitutes a valid region:

A single cell containing a 1
A cell containing a 2 and exactly one of its non-blank orthogonal neighbors
A cell containing a 3 and exactly two of its non-blank orthogonal neighbors
A cell containing a 4 and exactly three of its non-blank orthogonal neighbors

This is code-golf, so the shortest valid answer, in bytes, wins.
Some test cases:
1. A rather trivial one:

And this is the solution, with each region in a different color:

2. A more interesting one

This one has more than one solution, but here's one of them:

3. A smaller one, containing blanks, that doesn't have any solutions (depending on whether you use one of the twos to "capture" the three, or the three to take two of the twos, you're either left with a pair of nonadjacent [and therefore nongroupable] twos or a single two on its own):

Because this grid has no solutions, your program should halt without producing any output when given this grid.
4. This one (with the top 2 shifted one cell to the left) does have a solution though:

Solution:

(The bottom right 2 is used to "capture" the 3)
5. Because we needed a test case with some fours:

One solution:

It would be helpful if there were ASCII versions of the test cases so people don't have to type them all up, and the test cases should also cover 4s if those are valid input.

does orthogonal neighbors means only left right up down, or also the diagonals? if only left right up down, how come the 3 is in the same region as the other two 3's?  one of them is not an orthogonal neighbor.

@EyalLev Only left-right-up-down. The top right 3 and its 2 neighbors constitute the region.

@SuperJedi224 the top right 3 and it's two neighbors constitute a valid region, yes, but those neighbors do not.  doesn't a region have to be a "closed set"? i.e. every member in the region must be a valid member of that region?

I know this challenge is over an year old, but I just found this in "unanswered" and looked quite interesting to me.
Assuming that the "root" cell's number is the only significant one in each region (deducible from the examples), here is my backtracking solution:
Python 3, 355 351 349 bytes
from itertools import*
def f(a):
 D=len(a[0])+1;S={D*r+c for r in range(len(a))for c in range(D-1)if a[r][c]};s=[{x,*t}for x in S for t in combinations({x-D,x-1,x+1,x+D}&S,a[x//D][x%D]-1)]
 def B(s,S,d=1):
  if{0}>S:return a
  if[]==s:return 0
  h,*t=s
  if h<=S:
   for x in h:a[x//D][x%D]=d
  return h<=S and B(t,S-h,d+1)or B(t,S,d)
 return B(s,S)

Try it online!
The input format is a 2D list of integers, blanks as zero, and the output format is also a 2D list of integers representing one region per number. The region number starts at one; zero is reserved for blank cells (as in input). If the given input is unsolvable, the function returns single zero (falsy value).
For example, the test case 5 is input as
[[2,3,2],
 [3,4,3],
 [0,4,0],
 [3,3,3],
 [2,3,2],
 [0,3,0]]

and the output is
[[1,1,1],
 [2,2,2],
 [0,2,0],
 [3,4,5],
 [3,4,5],
 [0,4,0]]

Ungolfed, with comments:
from itertools import*
def f(a):
 # Rows, cols, fake-cols to prevent neighbors wrap around
 R,C=len(a),len(a[0]);D=C+1
 # All valid cells represented as integers
 S={D*r+c for r in range(R) for c in range(C) if a[r][c]}
 # All valid regions rooted at each cell
 s=[{x,*t} for x in S for t in combinations({x-D,x-1,x+1,x+D}&S,a[x//D][x%D]-1)]
 # Start backtracking
 return backtrack(a,s,S,D)

# a: array to fill in the region numbers
# s: current candidates of regions
# S: current remaining cells to cover
# D: constant from f
# d: recursion depth == group number in the result
def backtrack(a,s,S,D,d=1):
 # Empty S: the board is correctly covered, return the result
 if not S:return a
 # Empty s: no more candidate regions to use, return false
 if not s:return 0
 h,*t=s
 # h is not a subset of S: h is not a valid cover, try with the rest using same depth
 if not h<=S:return backtrack(a,t,S,D,d)
 # h is a valid cover, write d to the cells in h
 for x in h:a[x//D][x%D]=d
 return backtrack(a,t,S-h,D,d+1)or backtrack(a,t,S,D,d)

Try it online!
Note: This is a special case of Set Packing which is well-known to be NP-complete. This specific problem has limited set size (max. 4) and there exist approximation algorithms to find "good" set packing in polynomial time, but they don't guarantee the maximum possible set packing (which is strictly required in this problem).

APL (Dyalog Unicode), 94 bytes
⎕CY'dfns'
{0≡a←X⊢b←⊃⍪/{v∊⍤1⊢⍵,x[(w[⍵]-1)cmat≢x←v∩⍵(+,-)↓0 2⊤⍳2]}∘⊂¨v←⍸×w←⍵:0⋄(b+.×⍨a×+\a)@v⊢w}

Try it online!
-4 bytes thanks to @Adám. Improvements are:

x←...⋄...cmat≢x → ...cmat≢x←... (-2 bytes)
(+\×⊢)a → a×+\a (-2 bytes)

APL (Dyalog Unicode), 98 bytes
⎕CY'dfns'
{0≡a←X⊢b←⊃⍪/{x←v∩⍵(+,-)↓0 2⊤⍳2⋄v∊⍤1⊢⍵,x[(w[⍵]-1)cmat≢x]}∘⊂¨v←⍸×w←⍵:0⋄(b+.×⍨(+\×⊢)a)@v⊢w}

Try it online!
Well, who would have imagined a language having Knuth's Algorithm X as a built-in library function? Algorithm X is an algorithm designed to solve Exact Cover problems, and the challenge here is exactly this kind of problem.
Now it just becomes a matter of constructing the constraint matrix (a boolean matrix whose columns represent constraints and rows represent actions that satisfy some of the constraints). Then X solves the problem by finding the collection of rows so that 1 appears exactly once per column.
Ungolfed with comments
⎕CY'dfns'  ⍝ Load `cmat` and `X`
f←{
  ⍝ v←Coordinates of nonzero positions
  v←⍸×w←⍵

  ⍝ Given an enclosed coord, generate constraint rows
  Rowgen←{
    ⍝ Extract 4-way neighbors that are part of the board
    x←v∩⍵(+,-)↓0 2⊤⍳2
              ↓0 2⊤⍳2  ⍝ Fancy way to say (0 1)(1 0)
        ⍵(+,-)         ⍝ Input coord plus/minus 1 horizontally/vertically
      v∩               ⍝ Set intersection with valid coords

    ⍝ Boolean matrix where each row represents a possible tile placement
    ⍝ and 1 marks the covered cells by that tile
    v∊⍤1⊢⍵,x[(w[⍵]-1)cmat≢x]
             (w[⍵]-1)cmat≢x   ⍝ Possible combinations of neighbors
         ⍵,x[              ]  ⍝ Index into x and prepend ⍵
    v∊⍤1⊢                     ⍝ Mark covered cells as 1
  }

  ⍝ bmat←Constraint matrix; vertical concatenation of constraint rows
  bmat←⊃⍪/Rowgen∘⊂¨v

  ⍝ ans←Solution by Algorithm X
  ans←X bmat

  ⍝ Return 0 if answer not found (single zero)
  0≡ans:0

  ⍝ Mark the pieces as distinct integers starting from 1
  ⍝ (increasing in the order of the root cell)
  (bmat+.×⍨(+\×⊢)ans)@v⊢w
           (+\×⊢)ans       ⍝ Assign distinct numbers to 1 bits
                           ⍝ 1 0 0 1 0 1 1 .. → 1 0 0 2 0 3 4 ..
   bmat+.×⍨                ⍝ Extract associated numbers for all valid cells
  (                 )@v⊢w  ⍝ Overwrite valid cells of w with ^
}

94


text:
Factorial digit sum
The challenge is to calculate the digit sum of the factorial of a number.

Example
Input: 10
Output: 27

10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,
and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27
You can expect the input to be an integer above 0.
Output can be of any type, but the answer should be in the standard base of the coding language.

Test cases:
10    27
19    45
469   4140
985   10053

N.B. Some languages can not support large numbers above 32-bit integers; for those languages you will not be expected to calculate large factorials.
OEIS link here thanks to Martin Ender

This is code-golf, so shortest code in characters wins!

What's the maximum input number to expect? With 32-bit integers in R this challenge can't be solved accurately past n>21

@Billywob For R then you will only need to go to 20. I shall edit question to reflect this

Great challenge!

05AB1E, 3 bytes
!SO

Try it online!
!   Factorial.
 S  Push characters separately.
  O Sum.

Jelly, 3 bytes
!DS

Try it online!
Does what you expect:
!    Factorial.
 D   Decimal digits.
  S  Sum.

Mathematica, 21 bytes
Tr@IntegerDigits[#!]&

came here to type these exact characters.

Why [#!] and not @#!? (Mathematica noob)

@Cyoce because @ has higher precedence than !.

C++11, 58 bytes
As unnamed lambda modifying its input:
[](int&n){int i=n;while(--n)i*=n;do n+=i%10;while(i/=10);}

One of the rare cases when my C++ code is shorter than the C code.
If you want to suppport larger cases, switch to C++14 and use:
[](auto&n){auto i=n;while(--n)i*=n;do n+=i%10;while(i/=10);}

and supply the calling argument with ull suffix.
Usage:
auto f=
[](int&n){int i=n;while(--n)i*=n;do n+=i%10;while(i/=10);}
;

main() {
  int n=10;
  f(n);
  printf("%d\n",n);
}

Ruby, 63 61 53 38 bytes
New approach thanks to manatwork:
->n{eval"#{(1..n).reduce:*}".chars*?+}

Old:
->n{(1..n).reduce(:*).to_s.chars.map(&:hex).reduce:+}

-3 bytes thanks to Martin Ender
-5 bytes thanks to G B

The old boring eval way: ->n{eval"#{(1..n).reduce:*}".chars*?+}.

Pyth, 7 6 bytes
Thanks to @Kade for saving me a byte
sj.!QT
Try it online!
This is my first time using Pyth, so I'm sure that my answer could be golfed quite a bit.
Explanation:
s Sum
  j the digits of
    .! the factorial of
      Q the input
    T in base 10

10 is assigned to a variable T, so you can make this sj.!QT :)

OK, thanks! I'll add it

Nice! ssM`.! does the job too, also in 6 bytes.

Haskell, 41 40 bytes
f x=sum$read.pure<$>(show$product[1..x])

Usage example: f 985 -> 10053.
Make a list from 1to x, calculate the product of the list elements, turn it into its string representation, turn each character into a number and sum them.
Edit: @Angs saved a byte. Thanks!

f x=sum$read.pure<$>(show$product[1..x]) saves a byte

Python, 54 bytes
f=lambda n,r=1:n and f(n-1,r*n)or sum(map(int,str(r)))

repl.it

I just came up with a slightly worse version of this that looks way too similar for it to be a separate answer. Bravo

R, 58 53 bytes
Edit: Saved one byte thanks to @Jonathan Carroll and a couple thanks to @Micky T
sum(as.double(el(strsplit(c(prod(1:scan()),""),""))))

Unfortunately, with 32-bit integers, this only works for n < 22. Takes input from stdin and outputs to stdout.
If one would like higher level precision, one would have to use some external library such as Rmpfr:
sum(as.numeric(el(strsplit(paste(factorial(Rmpfr::mpfr(scan()))),""))))

I reached the exact same answer as you did, then found a 1-byte gain on c(x,"") vs paste(x): sum(as.integer(el(strsplit(c(factorial(scan()),""),"")))). Coerces the factorial result to character and strsplit returns it as a second list, so el still works and extracts the first list elements.

how about prod(1:scan())?

also as.double  should suffice

@MickyT Thanks! Updated.

strtoi works as a shorter replacement as.double, I think.

A bit of playing around with splitting digits gives me this now sum(utf8ToInt(c(prod(1:scan()),''))-48) for 39

Pip, 8 bytes
$+$*++,a

Try it online!
Explanation
      ,a    # range
    ++      # increment
  $*        # fold multiplication
$+          # fold sum

Sorry, I actually managed to post an 05AB1E answer before you ;).

@carusocomputing: Hehe. Got me the opportunity to look into a new language :)

I think you're the first one besides me to use Pip for a non-polyglot code golf answer. :D

CJam, 8 bytes
rim!Ab:+

Try it online!
Explanation
r   e# Read input.
i   e# Convert to integer.
m!  e# Take factorial.
Ab  e# Get decimal digits.
:+  e# Sum.

APL (Dyalog Extended), 8 bytes
-3 thanks to @Razetime - i forgot to drop a paren lol
+/⍎¨∘⍕∘!

Explanation:
+/⍎¨∘⍕∘!
       !  ⍝ factorial of ⍵
     ⍕    ⍝ convert to string
  ⍎¨      ⍝ produce digit vector
+/        ⍝ sum all digits

Has some problems with factorial of 900, this code will work fine for ⍵>40:
b←({⍵⊣⍵.⎕CY'dfns'}⎕NS⍬).big
↑(+b/(⍎¨∘⍕∘(↑(×b/⍳))))

Try it online!

-3

1⊥10⊤! should work I guess (since you're using Extended). That said, the 8 byter works without Extended.

@Bubbler I was interested mostly in stock Dyalog APL-only solutions. I'll change it to Dyalog Unicode soon-ish

Ruby, 63 60 53 51 bytes
->n{a=0;f=(1..n).reduce:*;f.times{a+=f%10;f/=10};a}

Thanks to Martin for golfing help.

Java 7, 148 bytes
int s=1,ret=0;while(i>1){s=s*i; i--;}String y=String.valueOf(s);for(int j=0;j<y.length();j++){ret+=Integer.parseInt(y.substring(j,j+1));}return ret;

@EyalLev There is no limit specified in the question. How are you expecting long to handle a factorial that equates to larger than 9,223,372,036,854,775,807?

bash (seq,bc,fold,jq), 34 33 bytes
Surely not the most elegant but for the challenge
seq -s\* $1|bc|fold -1|jq -s add

fold -1 saves a byte.

@DigitalTrauma corrected! thanks

Brachylog, 5 bytes
$!@e+

Try it online!
Explanation
Basically the described algorithm:
$!       Take the factorial of the Input
  @e     Take the elements of this factorial (i.e. its digits)
    +    Output is the sum of those elements

Pushy, 4 bytes
fsS#

Give input on the command line: $ pushy facsum.pshy 5. Here's the breakdown:
f      % Factorial of input
 s     % Split into digits
  S    % Push sum of stack
   #   % Output

Octave, 30 bytes
@(n)sum(num2str(prod(1:n))-48)

Calculates the factorial by taking the product of the list [1 2 ... n]. Converts it to a string and subtracts 48 from all elements (ASCII code for 0). Finally it sums it up :)

C, 58 bytes
This is not perfect. Only works ones because a have to be -1 in start. The idea is to use two recursive function in one function. It was not as easy as I first thought.
a=-1;k(i){a=a<0?i-1:a;return a?k(i*a--):i?i%10+k(i/10):0;}

Usage and understandable format:
a = -1;
k(i){
   a = a<0 ? i-1 : a;
   return a ? k(i*a--) : i? i%10+k(i/10) :0;
}

main() {
   printf("%d\n",k(10));
}

Edit:
I found metode that let use this function multiple time but then length is 62 bytes.
a,b;k(i){a=b?a:i+(--b);return a?k(i*a--):i?i%10+k(i/10):++b;}

Nice idea, but I don't quite understand why it wouldn't be shorter to use one function to return the factorial and another to calculate the digit sum, like a(b(10)). Is the word "return" too long for that to work?

Return eats much. I try that of course. Maybe someone can do it at least i couldn't get that work

you could accept two arguments to save a few bytes: https://codegolf.stackexchange.com/a/153132/77415

Perl 6, 21 bytes
{[+] [*](2..$_).comb}

Expanded:
{  # bare block lambda with implicit parameter ｢$_｣

  [+]           # reduce the following with ｢&infix:<+>｣

    [*](        # reduce with ｢&infix:<*>｣
      2 .. $_   # a Range that include the numbers from 2 to the input (inclusive)
    ).comb      # split the product into digits
}

Congrats, you got answer no. 101010!

@RudolfL.Jelínek That's nothing, on StackOverflow, and Meta.StackExchange I am user number 1337

Cubix, 33 32 bytes
u*.$s.!(.01I^<W%NW!;<,;;q+p@Opus

Net form:
      u * .
      $ s .
      ! ( .
0 1 I ^ < W % N W ! ; <
, ; ; q + p @ O p u s .
. . . . . . . . . . . .
      . . .
      . . .
      . . .

Try it online!
Notes

Works with inputs up to and including 170, higher inputs result in an infinite loop, because their factorial yields the Infinity number (technically speaking, its a non-writable, non-enumerable and non-configurable property of the window object).
Accuracy is lost for inputs 19 and up, because numbers higher than 253 (= 9 007 199 254 740 992) cannot be accurately stored in JavaScript.

Explanation
This program consists of two loops. The first calculates the factorial of the input, the other splits the result into its digits and adds those together. Then the sum is printed, and the program finishes.
Start
First, we need to prepare the stack. For that part, we use the first three instructions. The IP starts on the fourth line, pointing east. The stack is empty.
      . . .
      . . .
      . . .
0 1 I . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
      . . .
      . . .
      . . .

We will keep the sum at the very bottom of the stack, so we need to start with 0 being the sum by storing that on the bottom of the stack. Then we need to push a 1, because the input will initially be multiplied by the number before it. If this were zero, the factorial would always yield zero as well. Lastly we read the input as an integer.
Now, the stack is [0, 1, input] and the IP is at the fourth line, the fourth column, pointing east.
Factorial loop
This is a simple loop that multiplies the top two elements of the stack (the result of the previous loop and the input - n, and then decrements the input. It breaks when the input reaches 0. The $ instruction causes the IP to skip the u-turn. The loop is the following part of the cube. The IP starts on the fourth line, fourth column.
      u * .
      $ s .
      ! ( .
. . . ^ < . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
      . . .
      . . .
      . . .

Because of the ^ character, the IP starts moving north immediately. Then the u turns the IP around and moves it one to the right. At the bottom, there's another arrow: < points the IP back into the ^. The stack starts as [previousresult, input-n], where n is the number of iterations. The following characters are executed in the loop:
*s(
*   # Multiply the top two items
    #   Stack: [previousresult, input-n, newresult]
 s  # Swap the top two items
    #   Stack: [previousresult, newresult, input-n]
  ( # Decrement the top item
    #   Stack: [previousresult, newresult, input-n-1]

Then the top of the stack (decreased input) is checked against 0 by the ! instruction, and if it is 0, the u character is skipped.
Sum the digits
The IP wraps around the cube, ending up on the very last character on the fourth line, initially pointing west. The following loop consists of pretty much all remaining characters:
      . . .
      . . .
      . . .
. . . . . W % N W ! ; <
, ; ; q + p @ O p u s .
. . . . . . . . . . . .
      . . .
      . . .
      . . .

The loop first deletes the top item from the stack (which is either 10 or 0), and then checks what is left of the result of the factorial. If that has been decreased to 0, the bottom of the stack (the sum) is printed and the program stops. Otherwise, the following instructions get executed (stack starts as [oldsum, ..., factorial]):
N%p+q;;,s;
N          # Push 10
           #   Stack: [oldsum, ..., factorial, 10]
 %         # Push factorial % 10
           #   Stack: [oldsum, ..., factorial, 10, factorial % 10]
  p        # Take the sum to the top
           #   Stack: [..., factorial, 10, factorial % 10, oldsum]
   +       # Add top items together
           #   Stack: [..., factorial, 10, factorial % 10, oldsum, newsum]
    q      # Send that to the bottom
           #   Stack: [newsum, ..., factorial, 10, factorial % 10, oldsum]
     ;;    # Delete top two items
           #   Stack: [newsum, ..., factorial, 10]
       ,   # Integer divide top two items
           #   Stack: [newsum, ..., factorial, 10, factorial/10]
        s; # Delete the second item
           #   Stack: [newsum, ..., factorial, factorial/10]

And the loop starts again, until factorial/10 equals 0.

C, 47 bytes
f(n,a){return n?f(n-1,a*n):a?a%10+f(0,a/10):0;}

usage:
f(n,a){return n?f(n-1,a*n):a?a%10+f(0,a/10):0;}
main() {
  printf("answer: %d\n",f(10,1));
}

Brachylog (v2), 3 bytes
ḟẹ+

Try it online!
Same "algorithm" as the v1 answer by @Fatalize, just with better encoding.

Python, 57 bytes
import math
lambda n:sum(map(int,str(math.factorial(n))))

Try it online

Could you use back ticks instead of str?

@nedla2004 That would append an L once the factorial is big enough to become a long.

Befunge 93, 56 54 bytes
Saved 2 bytes do to using get instead of quotes. This let me shift the top 2 lines over 1, reducing unnecessary white space.
Try it online!
&#:<_v#:-1
: \*$<:_^#
g::v>91+%+00
_v#<^p00</+19
@>$$.

Explanation:
&#:<                Gets an integer input (n), and reverses flow direction
&#:< _v#:-1         Pushes n through 0 onto the stack (descending order)

:  \*$<:_^#         Throws the 0 away and multiplies all the remaining numbers together

(reorganized to better show program flow):
vp00< /+19 _v#<    Stores the factorial at cell (0, 0). Pushes 3 of whatever's in
> 91+%+ 00g ::^    cell (0, 0). Pops a, and stores a / 10 at (0, 0),
                   and adds a % 10 to the sum.

@>$$.              Simply discards 2 unneeded 0s and prints the sum.

You are correct. I'm working on a new version. FYI, I'm using quickster.com, because others that I found didn't treat \ correctly when there was only one # in the stack.

Thanks! It looks like this code only works properly in the Befunge-98 version, probably because of the put method.

48 bytes which also handles 0 correctly

Javascript ES6 - 61 54 Bytes
n=>eval(`for(j of''+(a=_=>!_||_*a(~-_))(n,t=0))t-=-j`)

EDIT: Thank you Hedi and ETHproductions for shaving off 7 bytes. I'll have to remember that t-=-j trick.

Nice answer! You can save a couple bytes in various ways: n=>{a=_=>!_||_*a(~-_);t=0;for(j of''+a(n))t-=-j;return t}

@ETHproductions Some more bytes can be saved with eval : n=>eval(\for(j of''+(a==>!||*a(~-))(n,t=0))t-=-j`)`

@Hedi I know, I was taking it one step at a time :-)

Batch, 112 bytes
@set/af=1,t=0
@for /l %%i in (1,1,%1)do @set/af*=%%i
:g
@set/at+=f%%10,f/=10
@if %f% gtr 0 goto g
@echo %t%

Conveniently set/a works on a variable's current value, so it works normally inside a loop. Only works up to 12 due to the limitations of Batch's integer type, so in theory I could save a byte by assuming f<1e9:
@set/af=1,t=0
@for /l %%i in (1,1,%1)do @set/af*=%%i
@for /l %%i in (1,1,9)do @set/at+=f%%10,f/=10
@echo %t%

But that way lies madness... I might as well hard-code the list in that case (97 bytes):
@call:l %1 1 1 2 6 6 3 9 9 9 27 27 36 27
@exit/b
:l
@for /l %%i in (1,1,%1)do @shift
@echo %2

JavaScript (ES6), 50 bytes
f=(n,m=1,t=0)=>n?f(n-1,n*m):m?f(n,m/10|0,t+m%10):t

Only works up to n=22 due to floating-point accuracy limitations.

J, 12 11 bytes
Saved 1 byte thanks to cole!
1#.10#.inv!

This simply applies sum (1#.) to the digits (using inverse inv of base conversion #. with a base of 10) of the factorial (!) of the argument.
Test cases
Note: the last two test cases are bigints, as marked by a trailing x.
   f=:10#.inv!
   (,. f"0) 10 19 469x 985x
 10    27
 19    45
469  4140
985 10053

You can use "."0": to get digits

11 bytes: 1#.,.&.":@! which requires extended precision for smaller cases too (unsure why). Also 11 bytes: 1#.10#.inv!.

AHK, 60 bytes
a=1
Loop,%1%
a*=A_Index
Loop,Parse,a
b+=A_LoopField
Send,%b%

AutoHotkey doesn't have a built-in factorial function and the loop functions have long names for their built-in variables. The first loop is the factorial and the second is adding the digits together.

C, 63 60 bytes
-3 byte for do...while loop.
i;f(n){i=n;while(--n)i*=n;do n+=i%10;while(i/=10);return n;}

Ungolfed and usage:
i;
f(n){
 i=n;
 while(--n)
  i*=n;
 do
  n+=i%10;
 while(i/=10);
 return n;
}

main() {
 printf("%d\n",f(10));
}

Do we define f (n) as int by default?

@MukulKumar this is standard in C, if there is no type then int is assumed.

Q/KDB+ 41 Bytes
sum{:"I"$string x}over'string prd 1+til n

Breakdown:
string prd 1+til n

Get the product from 1 to n
{:"I"$string x}

Function that accepts a string x and returns it converted to an integer.
over'

Iterate over the argument to it's right to the function on the left, passing each item in individually.
sum

Sum up the numbers output by the function at the end.

PHP, 44 bytes
<?=array_sum(str_split(gmp_fact($argv[1])));

Well it's not clever, but it works. That said it turned out better than I thought (I thought I'd need to use gmp_strval() too).

Pyke, 3 bytes (old version)
SBs

Explanation:
SB  -  product(range(1, input+1))
  s - digit_sum(^)

Groovy, 61 bytes
{"${(1..it).inject{i,r->i*r}}".collect{0.parseInt(it)}.sum()}

Groovy doesn't even have factorial built-ins.
"${(1..it).inject{i,r->i*r}}" - Compute factorial as string.
.collect{0.parseInt(it)} - Turn the string into an array of integers.
.sum() - Sum 'em.

C#, 119 116 Bytes
Edit: Saved 3 Bytes thanks to @TheLethalCoder
Golfed:
long F(int n){long f=1;int s=0;for(;n>1;)f*=n--;foreach(var c in f.ToString().ToList())s+=int.Parse(c+"");return s;}

Ungolfed:
public long F(int n)
{
  long f = 1;
  int s = 0;
  for (; n > 1;)
    f *= n--;
  foreach (var c in f.ToString().ToList())
    s += int.Parse(c + "");
  return s;
}

Tried both a long and an Int64 and it won't take higher than n=20, ultimately went with long because it is shorter...
Testing:
  Console.WriteLine(new DigitalSumFactorial().F(10));
  //27
  Console.WriteLine(new DigitalSumFactorial().F(19));
  //45
  Console.WriteLine(new DigitalSumFactorial().F(20));
  //54

You can compile to a Func<int, long> to save bytes, the for loop can be simplified to for (; i > 1;) and then set i = n outside the loop above and post decrement i in the loop i.e. f *= i--;. I think the ToList() isn't needed although I haven't tried it and you will need to add using System.Linq; into the byte count for the ForEach part

int.Parse(c+"") can be replaced with c-30 I think...

Its 48 not 30 I read the hex code by accident, also you can't remove the ToList, putting all of that together is 113 bytes including the 18 for the using statement: using System.Linq;n=>{long f=1;int s=0,i=n;for(;i>1;)f*=i--;f.ToString().ToList().ForEach(c=>s+=c-48);return s;};

@TheLethalCoder Thanks for the tips :) I've had another play around with it and saved 3 Bytes :)

Wonder, 22 bytes
@sum <>""prod rng1+1#0

This only works for inputs <= 21.
Usage:
(@sum <>""prod rng1+1#0)10

Explanation
Increment argument, tail-exclusive range from 1 to result, product, split over empty string, and sum.

F#, 80 bytes (74bytes for 32bit integer)
let rec s=function|0L->0L|y->y%10L+s(y/10L)
let g x={1L..x}|>Seq.fold (*) 1L|>s

F#, 98 bytes (96bytes for 32bit integer)
let f x=([1L..x]|>List.fold (*) 1L).ToString().ToCharArray()|>Array.fold (fun a c-> a+int(c)-48) 0

Test with
f 10L
g 10L

Thanks to ais523 for the anonymous match function and formatting help.

Hi, and welcome to the site! Your answers are actually slightly better than you thought; unless it's vital to your program, you can remove the newline at the end of a file and save a byte that way. (You can produce the nicely formatted headings we use elsewhere by starting the heading with a # sign.) Also, I think F# has the function notation for creating an anonymous match block (e.g. you can use let rec s=function|0L rather than let rec s x=match x with|0L); that should help you get your code a bit shorter.

Thank you, it's the first time I saw the anonymous match. I select the functions in my code editor which told me 81 characters selected without the newline. I'm wondering if I got it wrong.

Lithp, 73 bytes
#N::((sum (map (split (+ "" (prod (seq 1 N))) "") #C::((- (asc C) 48)))))

I'm not sure if I should be counting import calls. Here is how you would use the above snippet:
(
    (import "lists")
    (def f #N::((sum (map (split (+ "" (prod (seq 1 N))) "") #C::((- (asc C) 48))))))
    (print (f 10))
)

It works by calculating the factorial using prod/1, converts it to a string by doing (+ "" value), splits and maps the string to get the numeric value of each number (ASCII code - 48.) Lastly, we sum/1 the resulting list.

Pyt, 3 2 bytes
!Ś

Explanation:
        Implicit input
!       Get factorial
 Ś      Sum the digits

Try it online!

Japt, 3 bytes
Êìx

Try it
Get the factorial, split to a digit array and reduce by addition.

Tcl, 78 bytes
proc S n {proc F n {expr $n?($n)*\[F $n-1]:1}
expr [join [split [F $n] ""] +]}

Try it online!

K (ngn/k), 10 bytes
Solution:
+/10\*/1+!

Try it online!
Explanation to follow.

Java 10, 70 bytes
A lambda from long to int. Breaks for input over 20.
n->{var f=n;while(n>1)f*=--n;return(f+"").chars().map(c->c-48).sum();}

Try It Online
Java 10, 163 bytes
Fully arbitrary precision. A lambda from BigInteger to BigInteger.
n->{var i=n;var f=n;while(n.compareTo(n.ONE)>0)f=f.multiply(n=n.subtract(n.ONE));return(f+"").chars().mapToObj(c->i.valueOf(c-48)).reduce(n.ZERO,(a,b)->a.add(b));}

Try It Online
Ungolfed
n -> {
    var i = n;
    var f = n;
    while (n.compareTo(n.ONE) > 0)
        f = f.multiply(n = n.subtract(n.ONE));
    return (f + "").chars()
        .mapToObj(c -> i.valueOf(c - 48))
        .reduce(n.ZERO, (a, b) -> a.add(b))
    ;
}

Perl 5 -MList::Util=sum -MMath::BigInt -p, 43 bytes
Supports arbitrarily large factorials.
$_=sum(Math::BigInt->new($_)->bfac()=~/./g)

Try it online!
Perl 5 -MList::Util=sum,product -p, 27 bytes
Cannot handle extremely large factorials due to overflow.
$_=product 1..$_;$_=sum/./g

Try it online!

Scala, 30 bytes
1.to(_).product+""map(_-48)sum

Try it online!
And a 34 byte solution without postfix syntax:
x=>(""+1.to(x).product:\0)(_+_-48)

Try it in Scastie

Fig, \$3\log_{256}(96)\approx\$ 2.469 bytes
Sra

Try it online!
Sra
  a  # (num) range [1, a]
 r   # (lst) product
S    # (num) digit sum

Java8 -  112 Chars
(First time here...)
String.valueOf(LongStream.rangeClosed(2,i).reduce(1,(a,b)->a*b)).chars().map(Character::getNumericValue).sum();

Clojure, 65 bytes
(fn[i](apply +(map #(-(int %)48)(str(apply *(range 1(inc i)))))))

Straightforward, character \0 has integer value of 48.
Easier to follow steps:
(defn f [i] (->> i inc (range 1) (apply *) str (map #(- (int %) (int \0)) (apply +)))

Julia 0.6, 25 bytes
Julia functions are generic across input types, and generate optimized code for each combination of input types. This function works with machine sized integers or arbitrary precision integers depending on the type of the argument. eg
f(10) = 27
f(50) = -97 # overflowed
f(big(50)) = 216 # no overflow, but slower due to use of BigInt

x->sum(digits(prod(1:x)))

Try it online!

Pari/GP, 16 bytes
n->sumdigits(n!)

Try it online!

Python 3, 66 bytes
import math;print(sum(map(int,str(math.factorial(int(input()))))))

It gets factorial of number, splits it into an array, then prints it!

Welcome to PPCG!

MATL, 9 bytes
:p[]&V!Us

Try it online!
MATL port of Stewie Griffin's Octave answer. Works up to n=22, same as the Octave and R answers.
:p - factorial.
[]&V - string representation of the number, fully expanded (without the []&, larger numbers use the scientific notation which won't do for our purposes).
!U transpose and convert back to numbers, getting individual digits.
s - sum those digits.
The []& part can be removed for -3 bytes, but then the range is further limited to only work up to 17, instead of 22.
I could stretch the input range to 23 with a couple of tricks, but that costs an additional 20 bytes:
:1w5X2Y%"@*t10\~?10/]][]&V!Us
(basically, use the uint64 data type instead of the usual double, multiply by each number upto the given number, but divide away 10 whenever our product is divisible by it (since trailing zeros add nothing to the digit sum).)
That seems to be as far as we can go with MATLAB/MATL without doing an ad-hoc implementation of bignum in the program.

Vyxal, 2 bytes
‼∑

Try it Online!
A very literal interpretation of the challenge: sum_of_digits_of(factorial(input))

J-uby, 21 bytes
:+|:/&:*|:digits|:sum

Attempt This Online!
Explanation
:+ | :/ & :* | :digits | :sum

:+ |                           # Range 1..n, then
     :/ & :* |                 # Reduce with product, then
               :digits | :sum  # Sum digits

q, 19 bytes
sum 10 vs prd 1+til

k, 11 bytes
+/10\:*/1+!

prd 1+til generate the factorial of input
10 vs convert factorial to digits

TI-Basic, 24 bytes (non-competing)
sum(10fPart(.1seq(int(Ans!/₁₀^(I)),I,0,int(log(Ans!

Only works for nonnegative integers up to 18, inclusive, and works up to 20 if you round to the nearest multiple of 9 when the input is greater than 5.

Thunno 2 S, 1 byte
w

Attempt This Online!
Thunno 2, 2 bytes
wS

Attempt This Online!


text:
Make your program sequential!
Your task, if you choose to accept it, is simple.
Objective
You must make a program that, when run, prints some (as many as you want) terms in a sequence that you choose. The sequence must be a valid OEIS sequence. The twist is that when you take the characters from your code that make up your sequence, string them together and run them in the same language, you should get the formula for the nth of your sequence for your sequence.
Example
Let's say I made this program:
abcdefghij

and chose the sequence of squares: http://oeis.org/A000290
and I chose it to print the first 5 terms of the sequence, the output should be:
1, 4, 9, 16, 25

Note: the output is flexible, you can choose what delimiter you want separating the terms, but the delimiter should be noticeable so that each of the terms of the sequence can be differentiated.
Now, the character at index 1 is a. The character at index 4 is d. The character at index 9 is i. So my new program would be:
adi

and it would have to print the formula for the nth term for my sequence, which is:
n^2

Simple!
Other things

You must print a minimum of 5 terms.
You may choose to 0- or 1-index.
Repeated numbers means repeated characters.
If your sequence isn't in order (e.g. it goes backwards), then your code still follows it (e.g. your code is written backwards).
You must use and only use the numbers in bounds of your answer, even if it has already gone out of bounds. You cannot use numbers from the same sequence you did not print.
If your sequence does not officially have a formula, you may use the first 3 letters of the name stated on the OEIS website (e.g. the fibonacci sequence would print fib and the lucas-lehmer sequence would print luc).

Remember, this is code-golf, so shortest answer, in bytes, wins!

Comments are not for extended discussion; this conversation has been moved to chat.

Must the variable name be n?

I'm putting this on hold until a few more details about the challenge are sorted out (see the chatroom linked above).

To people already casting reopen votes. If one answer assumes that you should take as many values from the sequence as possible, and another answer assumes that you only take as many as you've printed in the full program, then the challenge is unclear and needs to be improved before adding even more answers. Plus, this is not the only edge case that isn't addressed yet (how should non-increasing sequences, or sequences with  repeated values be handled?).

I absolutely love this challenge, but it should be a contest to see who can use the most complex formula.

@caruso Define "most complex" objectively.

@cat bytecount of the equation.

05AB1E, 10 bytes, A008585
This code outputs the first 11 elements of the sequence 3n.
3TÝ' §n*»J

Try it online!
Explanation
3            # push 3
             # STACK: 3
 TÝ          # push range [0 ... 10]
             # STACK: 3, [0,1,2,3,4,5,6,7,8,9,10]
   ' §       # push a space char converted to string
             # STACK: 3, [0,1,2,3,4,5,6,7,8,9,10], " "
      n      # square the string
             # STACK: 3, [0,1,2,3,4,5,6,7,8,9,10]
       *     # multiply the top 2 elements of the stack
             # STACK: [0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30]
        »    # join by newlines
         J   # join to string

Taking every nth item (0-indexed) gives:
3'nJ

which outputs 3n

Python 2, 35 Bytes
I decided to use the obvious sequence A000027, which essentially has the formula n ;) If you run the following code:
#print'n'
n=1
exec'print n;n+=1;'*8

You get the output:
1
2
3
4
5
6
7
8

And if you take the 8 characters from my source code (0-indexed), you get this:
print'n'

Which simply prints n.

If you were hoping for a more exciting answer, here's a Python 2 solution for n^2, i.e. A000290:
#p  r    i      n        t          '            n              ^                2                  '
n=1
exec'print n*n;n+=1;'*10

05AB1E, 7 6 bytes, A000027
5L'n s

Try it online!
Explanation:
5L      # Push [1, 2, 3, 4, 5]
  'n    # Push "n"
        # Do nothing
     s  # Swap (only in original program)
        # Implicit print

4L"n"s is also an option, or am I way off base here?

Yes it is. But it needs to be 5 not 4

"and I chose it to print the first 5 terms of the sequence" - OP

@carusocomputing Look on the bottom

Octave, 64 bytes A000290
I went for the n^2 one:
@()(1:5 ).^2 % '        n          ^            2              '

Take the terms 1, 4, 9, 16, 25, 36, 49 and 64 to get:
@()'n^2'

which prints:
n^2

05AB1E, 30 28 bytes, A000290
This is the sequence of squares
"  n    ^      2        "5Ln

Outputs the first 5 terms of the sequence with the formula n^2:
[1, 4, 9, 16, 25]

Try it online!
This is 1-indexed. So taking the characters from the code that make up the sequence, I get
"n^2"

Which outputs
n^2

Try it online!
Explanation
"  n    ^      2        "              # push this string
                         5             # push 5
                          L            # push range [1, ..., 5]
                            n          # square it
                                       # implicit output

MATL, 8 bytes, A000027
Thanks to Oliver for a correction interpreting the challenge
'n'  5:&

The code prints 1 2 3 4 5. Keeping only the first give chars it prints n.
Try it online!

Octave, 49 bytes, A109234
@()  1      :      5     %'floor (n*sin h(1)) ';]

The sequence floor(n*sinh(1)) are all numbers from 1 and up, except 6, 13, 20, 26, 33, 40, 46, _3, _0, _6 ... So, the characters used to make 1 2 3 4 5 must be placed in those positions. The remaining positions are used for the string explaining the function.

Wonder, 16 bytes A005843
 0";2"tk 5gen *2

This was once DASH, but has now been renamed to Wonder.
Outputs the first 6 even numbers. Note the leading space. Keeping the indices 0, 2, 4, 6, and 8 yields:
 "2t

Which prints 2t.
Explanation
0";2"

This is just a string and a number.
tk 5gen *2

This generates an infinite list of even numbers starting from 0, then takes the first 5 items from that list.

05AB1E, 15 bytes, A001477
"n-1"     žhSðý

Uses the CP-1252 encoding. Try it online!

Haystack, 21 10 9 Bytes
Haystack has had a lot of new features added in the past few days :) Of course, I am going to use A000027. Here's the inital program:
<"n"o|OR4

This will print out:
[1, 2, 3, 4, 5]

And if you take the characters 1-5, 0-indexed, you get:
"n"o|

Which prints n.

If you want to have some more fun, here's a solution for A000290:
^"_(n\D2l^
3keU02/:[W
D5m"5s\ih_
Cr:OF]uAIe
hWd>g|AkuH
/6R>ud*O,\
)G:q$n|4y{
:|v\X:?dP/

 If you want to see only the necessary chars, click here.

This will print the first 7 squares, and their corresponding chars in the above program, 0-indexed, are:
"n^2"O|

Which prints n^2.


text:
Display a chain of little mountains with an odd number on the top of it!
First line is made with ceil(n/2) elements where each element is: <space><odd-number><space>
Second line is made with ceil(n/2) elements, but each element is / \ only.
You may assume n >= 0 and n <= 10.
Examples
Input: 3
 1  3
/ \/ \

Input: 10
 1  3  5  7  9
/ \/ \/ \/ \/ \

Example in Python 3, 103 bytes:
lambda a:print("".join([" "+str(i)+" "for i in range(1,a+1,2)]+["\n"]+["/ \\"for i in range(1,a+1,2)]))

Shortest code in bytes wins :)

Can you assume all input will be less then 11?

Yup, all input will be less than 11 !

Welcome to the site! Our default for [tag:code-golf] is to count in bytes, not characters. If you want to override that, though, it's your choice. Also, I would recommend the Sandbox the next time :)

I meant bytes you're right ! Is there a good bytes counter around ?

How specifically do we have to handle whitespace? You say each element is <space><odd-number><space>, but the test cases don't have a space after the last odd number. Is it optional? Also, is the output for n=0 two empty lines?

Last space is optional and n = 0 = empty line, you're right :)

05AB1E, 19 15 14 12 bytes
05AB1E uses CP-1252 encoding.
Saved 4 bytes thanks to Adnan.
Saved 2 bytes thanks to carusocomputing
ÅÉðìDg…/ \×»

Try it online!
Explanation
ÅÉ               # list of uneven number up to input
  ðì             # prepend a space to each
    Dg           # get length of list
      …/ \       # push the string "/ \"
          ×      # repeat the string length-list times
           »     # join rows by spaces and columns by newlines

HOW LONG HAS Ï EXISTED?! That seems suuuper useful.

@carusocomputing A long time :p

LDÉÏ is the same as ÅÉ and „  ýðì can be replaced by ðì)» :).

@Adnan: Nice! I didn't know about ÅÉ.

You can remove the ), can't you?

ÅÉðìDg…/ \×» uses Dg instead of ¹;î for another byte save as well.

@carusocomputing: Nice catch!

Well done ! I think it's the shortest one :D

Pyke, 16 bytes
S2%idm+dJil*"/ \

Try it here!
17 bytes and more awesome
S2%i`~Bd.:il*"/ \

Try it here!
This uses IMHO an AWESOME algorithm for making sure the first line is correctly aligned.
S                 - range(1, input+1)
 2%               -  ^[::2]
   i              -   i = ^
    `             -    str(^)
     ~Bd.:        -     ^.translate("><+-.,[]", " ") <-- awesome bit here
          il      -  len(i)
            *"/ \ - ^ * "/ \"

This replaces all the characters in the stringified list with spaces. ~B contains all the characters in the Brain**** language and this is the first time I've used this variable.
The program `~Bd.: does this:
`~Bd.: - input = [1, 3, 5, 7]
`      - str(input)  # stack now ["[1, 3, 5, 7]"]
 ~B    - "><+-.,[]"  # stack now ["[1, 3, 5, 7]", "><+-.,[]"]
   d   - " "         # stack now ["[1, 3, 5, 7]", "><+-.,[]", " "]
    .: - translate() # stack now [" 1  3  5  7 "]

...this is...just awesome? You know you just beat 05AB1E and everyone, right?

I have tried Jelly; it will surely be much longer.

"I used the BF charset to evenly space an array of numbers" The things you never thought you'd say...

This is really clever :) Well done

@ErikGolferエリックゴルファー Not beating 05AB1E any more.

Python 2 3, 67 65 63 60 Bytes
Nothing too crazy here, I think the first section can probably be done shorter but I'm not quite sure how. I use the fact that in this case -~n/2 will work for ceil.
lambda n:-~n//2*' %d '%(*range(1,n+1,2),)+'\n'+-~n//2*'/ \\'

Below are alternative 61 and 65 byte solutions in Python 2:
lambda n:-~n/2*' %d '%tuple(range(1,n+1,2))+'\n'+-~n/2*'/ \\'
lambda n:' '+'  '.join(map(str,range(1,n+1,2)))+'\n'+-~n/2*'/ \\'

Thanks to Rod for saving 2 bytes and Artyer for saving another byte by switching version :)

If you move to Python 3, you can replace %(tuple(...)) with %[*...], but you would have to do -~n//2

@Artyer Tried this, but it throws a bunch of errors. I think I would need to cast range to a list because 3's range is like Python 2's xrange.

you can also drop the parentheses that are surrounding the tuple()

You can do (*<iterable>,) to cast to tuple in Python 3. This saves 1 byte though after you turn n/2 into n//2 for Python 3.

@Rod and Artyer thanks a bunch! :)

Python 2, 63 bytes
lambda n:' '.join(n%2*`n`for n in range(n+1))+'\n'+-~n/2*'/ \\'

Little trick for the first line: it don't print the even numbers, but take them as an empty string, which leads to starting empty space (0 would be there), and double spaces between the numbers without any modification on the range, the downside is a leading space in the even numbered n

JavaScript (ES6), 55 bytes

f=n=>n%2?f(n-1).replace(`
`,` ${n}
/ \\`):n?f(n-1):`
`
<input type=number min=1 max=10 oninput=o.textContent=f(this.value)><pre id=o>

Note the space on the end of the second line.

Dangit, I thought .replace might be better but I didn't bother to check...

The question says "you may assume..."

@SolomonUcko The HTML is not part of the answer, it merely serves to demonstrate its operation. As such, it might as well limit the value to between 1 and 10, since the result wouldn't be valid otherwise.

I see. You would have to determine the correct spacing otherwise

Vim, 73 59 56 bytes
This is a really high byte count IMO for what seems like a simple problem.  I feel like I'm missing something obvious.
caw="/2*2
caw1357911/"
DYp:s;.;/ \\;g
k:s// & /g

Try it online!
Unprintables:
^Acaw^R=^R"/2*2      # Transform a number into the next odd number (3->5,4>5)
^[^Acaw1357911^[/^R" # Insert 1357911, delete everything after the number above
DYp:s;.;/ \\;g       # Duplicate the line, replace numbers with / \
k:s// & /g           # On the line above, add spaces around numbers
<trailing newline>

Nice, I always upvote vim! However, unprintable characters also count as bytes, so this solution really is 73 bytes. Sorry about that!

I do have some tips however. 1) If you use a different seperator on your substitute command, you won't need to escape the forward slash, so you can do :s;.;/ \\;g. 2) on your second substitute command, you can leave the search empty and it will use your last search (which just so happens to be the same). Also, & is equivalent to \0 and one byte shorter. So you get :s// & /g

Thanks!  I was hoping to see a V answer from you to see if you used a different approach for fewer bytes, but that's alright!  The first comment, I think, is a function of me forgetting to update the Try it Online link.  The second got me 3 bytes, so thank you!

Python 2, 53 bytes
lambda n:" 1  3  5  7  9"[:-~n/2*3]+'\n'+-~n/2*"/ \\"

Takes advantage of the restriction n <= 10 to generate the top line by chopping off a piece from a hardcoded string.
The outputs for 1 to 10 are
 1
/ \
 1
/ \
 1  3
/ \/ \
 1  3
/ \/ \
 1  3  5
/ \/ \/ \
 1  3  5
/ \/ \/ \
 1  3  5  7
/ \/ \/ \/ \
 1  3  5  7
/ \/ \/ \/ \
 1  3  5  7  9
/ \/ \/ \/ \/ \
 1  3  5  7  9
/ \/ \/ \/ \/ \

The output for 0 is two empty lines.

Mathematica, 65 bytes
" "<>Range[1,#,2]~StringRiffle~"  "<>"
"<>"/ \\"~Table~⌈#/2⌉&

Anonymous function. Takes a number as input and returns a string as output. The Unicode characters, respectively, are U+2308 LEFT CEILING for \[LeftCeiling] and U+2309 RIGHT CEILING for \[RightCeiling].

WinDbg, 100 bytes
.echo;.for(r$t1=1;@$t1<=2*@$t0+@$t0%2;r$t1=@$t1+2){j@$t1<=@$t0 .printf"\b %d \n",@$t1;.printf"/ \\"}

Input is done by setting a value in the pseudo-register $t0.
Looks like it's shortest here just to print the string as it's being built rather than try to build it first and display the whole thing. I'd have a shorter solution if WinDbg would let me write to address 0.
How it works:
.echo;                                            * Print a new line that'll be deleted
.for(r$t1=1; @$t1 <= 2*@$t0+@$t0%2; r$t1=@$t1+2)  * Enumerate 1 to 4*ceil($t0/2), count by 2
{
    j@$t1<=@$t0                                   * If $t1 <= $t0...
        .printf"\b %d \n",@$t1;                   * ...Print $t1 (and newline for last n)
        .printf"/ \\"                             * ...Else print the / \'s
}

Output for each value of n:
0:000> .for(r$t0=0;b>@$t0;r$t0=@$t0+1){.printf"\n\nn=%d\n",@$t0; .echo;.for(r$t1=1;@$t1<=2*@$t0+@$t0%2;r$t1=@$t1+2){j@$t1<=@$t0 .printf"\b %d \n",@$t1;.printf"/ \\"}}

n=0

n=1
 1
/ \

n=2
 1
/ \

n=3
 1  3
/ \/ \

n=4
 1  3
/ \/ \

n=5
 1  3  5
/ \/ \/ \

n=6
 1  3  5
/ \/ \/ \

n=7
 1  3  5  7
/ \/ \/ \/ \

n=8
 1  3  5  7
/ \/ \/ \/ \

n=9
 1  3  5  7  9
/ \/ \/ \/ \/ \

n=10
 1  3  5  7  9
/ \/ \/ \/ \/ \

Java, 118 112 Bytes
Edit: Saved 6 Bytes thanks to @peech
Golfed:
String M(int n){String o=" ";int i=1;n+=1;for(;i<n;i+=2)o+=i+"  ";o+="\n";for(i=0;i<n/2;i++)o+="/ \\";return o;}

Ungolfed:
public String M(int n)
{
    String o = " ";
    int i=1;
    n += 1;
    for (; i < n;i+=2)
        o += i + "  ";
    o += "\n";
    for (i = 0; i < n/2; i++)
        o += "/ \\";
    return o;
}

Testing:
    OddMountains om = new OddMountains();
    System.out.println(om.M(1));
    System.out.println();
    System.out.println(om.M(3));
    System.out.println();
    System.out.println(om.M(5));
    System.out.println();
    System.out.println(om.M(7));
    System.out.println();
    System.out.println(om.M(10));

 1
/ \

 1  3
/ \/ \

 1  3  5
/ \/ \/ \

 1  3  5  7  9
/ \/ \/ \/ \/ \

Ahhhh, you've beat me to it :) i also wanted to post a Java answer. anyhow, here are some suggestions to golf it a bit more: you dont need to initialize i in your first for loop, it could look like this for(; i < n; i++). You can golf it even further with this change: o += i + "  "; changes to o += i++ + "  "; and for loop becomes for(; i < n; ). That is if you want to keep if statement. You could change your increment of i to i += 2  and delete the whole if statement, but in that case my second proposition doesnt apply :) (ps: i havent tested this :) )

@peech If it's any consolation, it's normally a race for me to get the first C# answer in. If that's gone, I fumble my way through a Java answer :) Thanks for the tips. I've removed the i initialisation from the for loop, but the other things got it stuck in a loop. I might need to play around with it a little more :)

Huh, I'm so glad that in my previous comment I said "i havent tested this" ... of course it doesnt work with o += i++ + " "; :). Btw, you have a tiny bug in your code :) since Java uses floor() on integer division (4 / 3 = 1), you should do it like this: int i = 1; n += 1; for (; i < n; i += 2) { ... jada jada ... }. if you increment i by i += 2, you don't need that if statement checking for parity. It also saves another 3 bytes :)  try it here: https://ideone.com/ekaUUH

@peech If someone is confident enough to correct my code, I assume it must be right, so when it doesn't work, I try again and again, thinking "it must be me..." :) No worries! Thanks for the tips - I discovered the floor division quirk myself when playing with some Java a few days ago :)

><> (FISH), 69 60 68 55 bytes
5|v&+%1:,2
1->:?!v:
8~v!?l<on$o:*4
a&/o
1->:?!;"\ /"ooo

Paste it into this online interpreter!
The number 5 on the first line is your input value (hard coded as 5, replaced by 0-a or i for user input).
Edit 1: Moved new line placement into the first line space (was empty) to save 9 bytes overall on space from a new line.
Edit 2: As noted by user7150406 the output was wrong (no spaces printing) this has been fixed with a loss of 8 bytes.
Edit 3: completely changed the logic, there is no point checking if the number is odd - rather put all numbers on the stack and remove every second one. Byte saved 13!

C#6, 95 bytes
n=>{var o="";int i=1;for(;i<=n;i+=2)o+=$" {i} ";o+='\n';for(i=1;i<=n;i+=2)o+="/ \\";return o;};

Full lambda:
Func<int, string> a = n=>
{
    var o="";int i=1;
    for(;i<=n;i+=2)
        o+=$" {i} ";
    o+='\n';
    for(i=1;i<=n;i+=2)
        o+="/ \\";
    return o;
};

CJam, 26 23 bytes
Sri,:)2%_S2**N@,"/ \\"*

Test it!
-3 thanks to 8478 (Martin Ender)

You can save 3 bytes by avoiding some of the stack manipulation: Sri,:)2%_S2**N@,"/ \\"*

@MartinEnder Oh, so that's why I couldn't remove that +. And I swear, I really used ed! ...shorter than Pyth.

Pyth, 24 22 bytes
K-SQyMS5+dj*2dK*lK"/ \

Thanks to 42545 (ETHproductions) for -1 byte
Online interpreter
11 test cases

Save a quote with *lK"/ \\

@ETHproductions You can then use \ instead of \\ :)

Game Maker Language (GM 8.0), 97 bytes
m=ceil(argument0/2)e=""for(i=1;i<2*m;i+=2)e+=" "+string(i)+" "return e+"#"+string_repeat("/ \",m)

Given that the input is at most 10, chr(48+i) will work in place of string(i), although the number of bytes is the same.
Readable:
m = ceil(argument0/2)
e = ""
for (i = 1; i < 2*m; i += 2 )
  e += " " + string(i) + " "
return e + "#" + string_repeat("/ \", m)

><> (Fish) 52 63 62 bytes
<v!?:-1:!?-1%2:
 >~la}}" "72.
v!?-2lno<o"  "
o
>:?!;"\ /"ooo1-

Try it online!
To use simply place n on the stack and away you go!
Much of this is taken from @Teal-Pelican's answer :).
Edit: The output is actually not aligned correctly in either ><> submission! Fixing...
Edit2: I had to sacrifice some bytes, but the output is actually correct now.
Edit3: No more fun with \ / mirrors and I save 1 byte.
Output:
 1  3  5  7  9
/ \/ \/ \/ \/ \

Thanks for spotting the error in the printing, I'm editing my answer now (fairly trivial for mine) it's interesting seeing the base answer the same but a lot of byte saves.

No problem, I was happy to see a ><> submission! It's gonna be interesting to see which one ends up being smaller now as these changes hurt mine pretty bad haha.

Looks like I'm juuuust 5 bytes smaller :p.

I'm going to have another look at mine now to see if I can squeeze a few mote bytes out aha.

I got home and had an idea for a new way to go about it. My new answer is 55 bytes! :D - Thanks for making me work on this, it's been fun.

C, 100 79 77 bytes
#define P(s)for(i=0;i++<n;printf(s,i++));puts("");
i;f(n){P(" %d ")P("/ \\")}

R, 70 69 68 58 bytes
cat(paste("",z<-seq(,scan(),2)),"\n");for(i in z)cat("/ \\")

3:
#>  1  3
#> / \/ \

10:
#>  1  3  5  7  9
#> / \/ \/ \/ \/ \

Ruby 82 60 Bytes
Quick and dirty Ruby solution could definitely be better optimized if I was better with Ruby
puts "",1.step($*[0].to_i,2).map{|x|$><<" #{x} ";"/ \\"}*""

Usage: prog.rb 10
Output:
 1  3  5  7  9
/ \/ \/ \/ \/ \

edit: numerous edits and optimisations by @Manatwork!

print → $><< and use string interpolation " #{x} ". But the best would be to reduce the number of .each by outputting the 1st line directly from the callback and building up the 2nd line in a variable: s="";(1..$*[0].to_i).step(2){|x|$><<" #{x} ";s+="/ \\"};puts"",s. Or even puts"",(1..$*[0].to_i).step(2).map{|x|$><<" #{x} ";"/ \\"}*"".

Numeric#step accepts 2 parameter, so can avoid the lengthy range syntax that requires parenthesis around: (1..$*[0].to_i).step(2) → 1.step($*[0].to_i,2).

@manatwork really good suggestions! I can see myself using a lot of your advice in my future codegolf posts so I really appreciate the input.

Bash, 64, 59, 57, 51, 49, 48, 45 bytes
EDIT:

minus 3 bytes (use $1 instead of STDIN)
one more byte off by replacing -s "" with -s\
minus 2 bytes by replacing printf with seq -f (Thanks @Adam!)
refactored to script instead of function (to beat the ><>)
removed superfluous spaces
optimized the sed expression a bit

Golfed
Chunk (45 byte):
seq -f" %g " -s\  1 2 $1|sed 'p;s| . |/ \\|g'

Function (original version) (57 bytes):
M() { printf " %s %.0s" `seq 1 $1`|sed 'p;s| . |/ \\|g';}

Test
--- mountains.sh ----
#!/bin/bash
seq -f" %g " -s\  1 2 $1|sed 'p;s| . |/ \\|g'

>./mountains.sh 10
 1  3  5  7  9
/ \/ \/ \/ \/ \

>M 10
 1  3  5  7  9
/ \/ \/ \/ \/ \

The sed is brilliant. By not using a function nor printf, you save 10 bytes : seq -f" %g " -s "" 1 2 $1|sed 'p;s| . |/ \\|g'

That's a nice advice ! Thank you ! I still use cat to read the input from STDIN, as IMO it is not really fair to use a pre-defined variable to pass the data in.

$1 is just the first parameter transmitted to the program. I don't think it's cheating see http://meta.codegolf.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods

Yep, you are correct. Thanks again !

Befunge 93, 64 bytes
Try it Online!
 &61p1   v+2,,,"/ \"
_v#!`" ":<+2.," ":
 <^p00p10"|<"
@ >91+,$1v

JavaScript (ES6), 66 64 bytes
n=>(f=n=>n?f(n-1)+(n%2?n+s:s):s=" ")(n)+`
`+"/ \\".repeat(++n/2)

Recursively builds the first line, then appends the second. The first line is built with the observation that it's simply the range [0...n] with each item n transformed to a space if even, or n concatenated with a space if odd.

Python 2, 60 bytes
Saved 6 bytes thanks to @Kade!
lambda s:" "+"  ".join(`range(s+1)`[4::6])+"\n"+-~s/2*"/ \\"

You don't need to use a list() cast, removing it gets you to 60 :)

@Kade The backticks ```` make it a string. I can't do it like lambda s:" "+"  ".join(range(s+1)[1::2])+"\n"+-~s/2*"/ \\"e because then it would give a list of ints and it dies

Are you sure?

@Kade Huh. It doesn't work online... Never mind, I don't know why I thought it didn't work...

Batch, 107 bytes
@set s=
@set t=
@for /l %%i in (1,2,%1)do @call set s=%%s%%  %%i&call set t=%%t%%/ \
@echo%s%
@echo %t%

Scala, 99 95 Bytes
(? :Int)=>for(i<-0 to 1)println(1 to ?filter(c=>c%2>0)map(c=>if(i<1)s" $c "else"/ \\")mkString)

Ungolfed
(? :Int) =>
    for (i<-0 to 1)
        println(
            1 to ?filter(c=>c%2>0)
                  map(c=>if(i<1)s" $c "else"/ \\")
                  mkString
        )

Ruby, 48 bytes
->x{" 1  3  5  7  9 "[0..3*x-=x/2]+?\n+"/ \\"*x}

Octave, 45 bytes
f=@(n)reshape(sprintf(' /%d  \',1:2:n),2,[]);
Test:
f(8)
 1  3  5  7
/ \/ \/ \/ \

When input = 0, there is a / left :)

Didn't said your answer isn't correct ! Just noticed that small funny glitch :)

I can not assume n==0 :(

QBIC, 35 bytes
:[1,a,2|X=X+!b$+@ | Y=Y+@/ \|]?X ?Y

Explanation:
:           gets a CMD line param as INT 'a'
[1,a,2|     FOR b = 1 to a STEP 2
X=X+!b$+@ | Add to X$ the counter of our FOR loop and a trailing space
            Leading space is provided by the cast-to-string function.
Y=Y+@/ \|   Add to Y$ the mountain.
]           Close the first possible language construct (IF, DO or FOR). In this case: NEXT
?X ?Y       Print X$, Print Y$. The space adds a newline in the resulting QBASIC.

Perl, 46 + 2 (-pl flag) = 48 bytes
@_=map$_%2?$_:"",0..$_;$_="@_$/"."/ \\"x(@_/2)

Using:
perl -ple '@_=map$_%2?$_:"",0..$_;$_="@_$/"."/ \\"x(@_/2)' <<< 7

Or 52 bytes:
@_=map$_%2?$_:"",0..pop;print"@_$/","/ \\"x(@_/2),$/

Using:
perl -e '@_=map$_%2?$_:"",0..pop;print"@_$/","/ \\"x(@_/2),$/' 7

Kitanai, 140 bytes
$0[0]$1[int(input":")]$2[""]$3[""]$0#?(mod@2)($2[add(add(@" ")(string($0@)))"  "]
$3[add@"/ \"])?(neq@($1@))([add@1]&1)print($2@)print($3@)%