text:
Generate Pascal's triangle
Pascal's triangle is generated by starting with a 1 on the first row. On subsequent rows, the number is determined by the sum of the two numbers directly above it to the left and right.
To demonstrate, here are the first 5 rows of Pascal's triangle:
    1
   1 1
  1 2 1
 1 3 3 1
1 4 6 4 1

The Challenge
Given an input n (provided however is most convenient in your chosen language), generate the first n rows of Pascal's triangle. You may assume that n is an integer inclusively between 1 and 25. There must be a line break between each row and a space between each number, but aside from that, you may format it however you like.
This is code-golf, so the shortest solution wins.
Example I/O
> 1
1
> 9
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1

NB In a sense this is a simplified version of Distributing the balls

@Peter Olson: What's your opinion of ratchet freak's interpretation of "you may format it however you like"?  If I followed his interpretation I could shave 18 characters.

@StevenRumbalski He's fine. There's a newline between each row, and there is a space between each number, so it meets the criteria.

@Peter Olson:  Thanks for the clarification.  What about Tomas T's assumption that n is defined already?

@PeterOlson Will there ever be an accepted answer to this question?

@Gaffi Probably not, accepting an answer makes me feel like I'm ending the contest and discouraging new and possibly better answers.

J, 12 characters
":@(!{:)\@i.

   i.5
0 1 2 3 4
   {:i.5
4
   (i.5)!{:i.5
1 4 6 4 1
   (!{:)i.5
1 4 6 4 1
   (!{:)\i.5
1 0 0 0 0
1 1 0 0 0
1 2 1 0 0
1 3 3 1 0
1 4 6 4 1
   ":@(!{:)\i.5
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
   (":@(!{:)\@i.)`''
+----------------------------------+
|+-+------------------------------+|
||@|+-------------------------+--+||
|| ||+-+---------------------+|i.|||
|| |||\|+-------------------+||  |||
|| ||| ||+-+---------------+|||  |||
|| ||| |||@|+--+----------+||||  |||
|| ||| ||| ||":|+-+------+|||||  |||
|| ||| ||| ||  ||2|+-+--+||||||  |||
|| ||| ||| ||  || ||!|{:|||||||  |||
|| ||| ||| ||  || |+-+--+||||||  |||
|| ||| ||| ||  |+-+------+|||||  |||
|| ||| ||| |+--+----------+||||  |||
|| ||| ||+-+---------------+|||  |||
|| ||| |+-------------------+||  |||
|| ||+-+---------------------+|  |||
|| |+-------------------------+--+||
|+-+------------------------------+|
+----------------------------------+

J beats GolfScript?  Interesting.  I would like to see an explanation for this code, if you have time.

It's already split down, but here's a line by line if you'd like additional english.  Line 1 i.5 returns the first five naturals.    Line 2 adds {: "Tail" (return last).  Line 3 combines them with ! "Out Of" (number of combinations).  Line 4 (!{:)i.5 is the same. factoring the hook out.  So (!:) is an operation that transforms the first n naturals to the nth line of Pascal's triangle.  Line 5 applies it to all Prefixes (backslash) of 0..4, but J fills in the unused spots with 0, so the operation is combined (@) with the string formatting operation ":.  Very cool J, upvoted.

@JB Isn't ! means factorial here? Also we can get rid of @ at the right.

@ArtemIce Monadic ! means factorial; dyadic ! counts combinations.  The final @ in ":@(!{:)\@i. is just there to make this a stand-alone verb.

Python, 56 Bytes
a=[1];exec"print a;a=map(sum,zip([0]+a,a+[0]));"*input()

Sample usage:
echo 9 | python filename.py

Produces:
[1]
[1, 1]
[1, 2, 1]
[1, 3, 3, 1]
[1, 4, 6, 4, 1]
[1, 5, 10, 10, 5, 1]
[1, 6, 15, 20, 15, 6, 1]
[1, 7, 21, 35, 35, 21, 7, 1]
[1, 8, 28, 56, 70, 56, 28, 8, 1]

+1 Clever way to use exec avoid a for loop.

C, 522

A self demonstrating C answer. Couldn't be clearer!
Bonus points for finding the extra character.
#define returns return 0
#define fr for
#define twentyonechexpressis0 0
                                                                                i
                                                                               , x
                                                                              [ 52 ]
                                                                            [ 52] ,j, y
                                                                       ; main (c){fr (;i< c
                                                                    ; i++){ x[i][i]=x[ i][0]= 1
                                                         ; }for(i =2;i<c;i++){for (j=1;j<i;j++){x [i][j] =
                                    1 +x[i][j ]+x[i-1][j-1]+x[i-1] [j]+1-1+1-1+1-1+1-1+1-1+111-11- twentyonechexpressis0 -100-1; }
} ;for(i=0 ;i<c;i++){for(j=0;j<=i;j++){ printf("%3d%c",x[i][j],(1+1+1+1)*(1+1+1+1+1+1+1+1)) ;}putchar(1+1+(1<<1+1)+1+1+1+1+1+111111-111111-1);} /*thiscomment_takes28chars*/ returns; }

I can't help but feel that this misses the point of code golf. (I also can't help pointing out that the extra character is in the \binom{5}{4} position).

It was fun to write. That's generally what I come to codegolf for.

Clever :) Have an upvote. Maybe not a winner candidate but a creative one!

Mathematica: 36 (41?)

Mathematica has the Binomial function, but that takes the fun out of this.  I propose:
NestList[{0,##}+{##,0}&@@#&,{1},n-1]

The line above will render a ragged array such as:
{{1}, {1, 1}, {1, 2, 1}, {1, 3, 3, 1}, {1, 4, 6, 4, 1},
 {1, 5, 10, 10, 5, 1}, {1, 6, 15, 20, 15, 6, 1}}

Since this is a basic format in Mathematica I thought it would be acceptable, but as I read the rules again, I think it may not be.  Adding Grid@ will produce unequivocally acceptable output, for a total of 41 characters:
Grid@NestList[{0,##}+{##,0}&@@#&,{1},n-1]

n = 6:
1
1   1
1   2   1
1   3   3   1
1   4   6   4   1
1   5   10  10  5   1
1   6   15  20  15  6   1

Python, 94 91 88 70 63 characters
x=[1]
for i in input()*x:
 print x
 x=map(sum,zip([0]+x,x+[0]))

Golfscript (21 chars)
~]({0\{.@+\}/;1].p}*;

Since an explanation was requested:
# Stack contains 'n'
~](
# Stack: [] n
{
    # prev_row is [\binom{i,0} ... \binom{i,i}]
    # We loop to generate almost all of the next row as
    #     [(\binom{i,-1} + \binom{i,0}) ... (\binom{i,i-1} + \binom{i,i})]
    # \binom{i,-1} is, of course, 0
    # Stack: prev_row
    0\
    # Stack: 0 prev_row
    {
        # Stack: ... \binom{i,j-1} \binom{i,j}
        .@+\
        # Stack: ... (\binom{i,j-1} + \binom{i,j}) \binom{i,j}
    }/
    # Stack: \binom{i+1,0} ... \binom{i+1,i} \binom{i,i}
    # unless it's the first time round, when we still have 0
    # so we need to pop and then push a 1 for \binom{i+1,i+1}
    ;1]
    # next_row
    .p
}*
# final_row
;

You might want to try http://golf.shinh.org/p.rb?pascal+triangle

Could you please provide some pseudo-code or explanation?  I kind of understand what's going on, but I'm not entirely understanding the swapping part.

Thank you for the detailed explanation and excellent answer (+1), but I'm even more confused now.  The logic (process) isn't sitting right.

@MikeDtrick, there was a slight error in the explanation. There's also a subtle point which needed explaining, but which I'd missed because it's so long since I wrote the code.

Okay, it's starting to make sense.  My final question be does the printing and executing process work from the top down or the bottom up (1, 1 1, 1 2 1: top down, 1 2 1, 1 1, 1: bottom up)?

@MikeDtrick, top-down. The uncommented .p at the end of the loop prints the line that was just generated.

convey, 39 bytes
convey is a new 2d esolang I made. It is based on conveyor belts that move values around in a factory. v<^> are explicit belt directions, other connections are inferred, as each function has a fixed number of inputs and outputs. For example, + takes 2 values in and returns 1 value.
v<<<.~/.]
v>,v}"!{
"/&v}11
\v>+/^
$,^
_

Try it online!

A row enters the main part from the top left. Two tiles in, the row gets " copied down and right. The right part prepends a _, which is a so called 'default value'. The actual value of _ depends on the function it enters. It works like the neutral element, thus _ + 3 = 3, 4 * _ = 4.
To understand the next part we have to take a look at port order. For example, , will join two paths, favoring the main input port. The order is as follows (lower takes precedence):
For input:     For output:

   0                3
   v                ^
 1>f<3            2<f>0
   ^                v
   2                1

So the upper , will favor inputs from the left, and the lower , will favor inputs from the top. In the animation the arrow heads are drawn a bit thicker to indicate main ports.
On / (rising flank) whenever a new list enters the tile, _ gets pushed to the side port. _ and the row then get joined, whereas the _ comes from the main port and thus has right of way.
The bottom part appends a _ by similar means: \ (falling flank) pushes the length of the list to the side port, that will be set $ to _.
Finally, _ 1 2 1 and 1 2 1 _ get added in + and we get the next row 1 3 3 1! We print a newline /} (_ in } prints newlines) and then copy the row into the output "}. To prevent a row colliding with the next row when they get longer, we batch ~. the lists: we first let 1 element through, then 2, then 3 … by getting the indices /. of an list of n 1s ({!1}), that get discarded in a sink ].

unrelated question: how did you get the λ.land domain?

@Razetime most generic TLDs support non-latin letters/IDNs which are rarely taken because realistically you have to use the puny code variant (xn--wxa.land) most of the time. My more fun domain ꙮ.world f.e. lies in the extended Cyrillic UTF-8 block.

Ruby: 51 49 46 characters
(45 characters code + 1 character command line option)
p=[];$_.to_i.times{n=0;p p.map!{|i|n+n=i}<<1}

Thanks to:

jsvnm for suggesting an alternative for the value switching (2 characters)
G B for spotting out a  variable unused after previous improvement (4 characters)

Sample run:
bash-4.4$ ruby -ne 'p=[];$_.to_i.times{n=0;p p.map!{|i|n+n=i}<<1}' <<< 1
[1]

bash-4.4$ ruby -ne 'p=[];$_.to_i.times{n=0;p p.map!{|i|n+n=i}<<1}' <<< 9
[1]
[1, 1]
[1, 2, 1]
[1, 3, 3, 1]
[1, 4, 6, 4, 1]
[1, 5, 10, 10, 5, 1]
[1, 6, 15, 20, 15, 6, 1]
[1, 7, 21, 35, 35, 21, 7, 1]
[1, 8, 28, 56, 70, 56, 28, 8, 1]

Try it online!

you can save 2 chars with p.map!{|i|(v=n)+n=i}

Great one, @jsvnm! Man, how long I combined to shorten that part. Thanks.

Maybe a little late, but: why use the variable v?

Good catch, @GB! That left behind from 1st revision, where… where… doh. Where was also kind of useless. I guess it comes from an earlier attempt when used .map. Thank you.

Scala, 81 78 72 70 characters
81 chars: first attempt, shamelessly copied from the Python version :)
var x=Seq(1)
for(i<-1 to args(0).toInt){println(x)
x=(0+:x,x:+0).zipped.map(_+_)}

Run it as a script, or directly in the REPL.
Cut to 70 chars with something surprisingly readable and idiomatic:
Seq.iterate(Seq(1),readInt)(a=>(0+:a,a:+0).zipped.map(_+_))map println

Or 72 70 characters with a totally different method:
0 to(readInt-1)map(i=>println(0 to i map(1 to i combinations(_)size)))

1 for shameless copying!

The last version should be used carefully for huge values of readInt, like 50. ;)

@userunknown presumably that's why the question specifies an upper limit of 25...

It wasn't meant as critique, just as a warning for the curious.

Keg, 40 33 bytes
1:&¿1.
,(|(⑻|:⑻$@MCƒℤ. ,⑨)⑹_01.
,

Try it online!
Old Program Explained

Haskell, 94 92
f=[1]:[zipWith(+)(0:x)x++[1]|x<-f]
main=readLn>>=mapM_(putStrLn.unwords.map show).(`take`f)

Output:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1

A 71 character version which does not print a space between each number:
f=[1]:[zipWith(+)(0:x)x++[1]|x<-f]
main=readLn>>=mapM_ print.(`take`f)

Output:
[1]
[1,1]
[1,2,1]
[1,3,3,1]

You can save a character by using mapM instead of mapM_.

R, 39 chars
R seems to be the very right tool for this task :-)
x=1;for(i in 1:n)x=c(print(x),0)+c(0,x)

You're missing one of the requirements: "Given an input n (provided however is most convenient in your chosen language)"

@Steven, "Given an input n"... so may I assume the n is given? I corrected the code. Is this now OK?

I'm asked Peter Olson to clarify.

@StevenRumbalski I don't think that's valid unless it takes input. I don't know R, so maybe the compiler makes it so that undefined variables prompt an input, so it might be ok, but if it's like most other languages in that regard, I don't think it is.

@PeterOlson, so you require to read it from console? That's clumsy and it spoils the solutions... then I would have to use scan() instead of n and have 5 characters more... Please confirm and I'll modify my solution.

@TomasT. I don't care how you get the input, as long is n is provided by input somehow.

@PeterOlson, what does it mean "provided by input"?

Basically, the n must be supplied from an external source at run time and the apparatus for capturing it is included in your program.  Typically, that means by command line argument, or stdin, or file.  By file is almost never used because it's invariably longer than the other two options.

Husk, 13 10 bytes
-3 bytes thanks to Zgarb
mw↑¡Sż+Θ;1

Try it online!
Explanation
Based on the same idea as my Pip answer: generate each row from the last one by tacking a 0 to the front of the row and adding it to itself element-wise. The Husk version creates the entire triangle as an infinite lazy list and then takes however many rows we need.
        ;1  Start with [1]
   ¡        Iterate this function:
    S        S-combinator: Sfgx is fx(gx) (aka f(x,g(x)) in C-style syntax)
     ż+       f: add a list itemwise to another list, keeping the extra value at
               the end of the longer list unchanged
       Θ      g: prepend a falsey value (given a list of integers, prepend 0)
             The result of Sż+Θ is a 1-argument function that prepends a 0 to its
              argument and adds that itemwise to another copy of the argument
  ↑         From the infinite list of results, take N (where N is the input)
mw          Join each sublist on spaces (which means the main list gets
             autojoined on newlines)

Nice first Husk answer! A couple of hints. Θ prepends a default falsy value, which is 0 for the number type. You can avoid creating a helper function with S. Sfg is equivalent to calling fg¹ from a separate line.

JavaScript (90 85 83 81)
for(n=prompt(o=i='');i++<n;o+='\n')for(s=j=1;j<=i;s=s*(i-j)/j++)o+=s+' ';alert(o)

Demo: http://jsfiddle.net/tcRCS/3/
NOTE: Doesn't work well in practice for about n > 30 because numbers overflow built-in integer data type and become floating-point numbers.

Edit 1: removed 5 characters by converting while to for and combining statements
Edit 2: move s= statement inside for and save 2 chars
Edit 3: combine s=1,j=1 initializer into s=j=1 and save 2 chars

Nice!  You can save one more character by changing "s=s*..." to "s*=..."

@DerekKurth: I had thought that when I was first doing optimizations, but that would mess up the logic because it needs to be s*(i-j)/j, not s*((i-j)/j).

Hmm, I tried it as s*=... in the jsfiddle and it seemed to work.  Maybe I did something wrong, though.

@DerekKurth: Technically it is the same, but the idea is that if you multiply by (i-j) before dividing by j, then there is no need for floating point arithmetic because the results should always be an integer.  If you do ((i-j)/j) first, this will result in decimal values which can be a source of error, and at the very least will require extra code for rounding/truncating.  You don't begin to see this until you get to about n>11, and you'll see decimal values in the output, i.e., 1 11 55 165 330 461.99999999999994 461.99999999999994...

Ah, that makes sense!

Perl, 52, 49 characters
Edit: using say instead of print
map{@_=(1,map$_[$_-1]+$_[$_],1..@_);say"@_"}1..<>

in Q (25 characters/20 with shorter version)
t:{(x-1) (p:{0+':x,0})\1}

Shorter
t:{(x-1){0+':x,0}\1}

Sample usage:
q)t 4
1
1 1
1 2 1
1 3 3 1

Or alternatively, 20 characters t:{(x-1){0+':x,0}\1}

Nice, shorter than the GolfScript solution now.

awk - 73 chars
fairly straightforward implementation:
{for(i=0;i<$1;++i)for(j=i;j>=0;)printf"%d%c",Y[j]+=i?Y[j-1]:1,j--?32:10}

sample run:
% awk -f pascal.awk <<<10
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
1 9 36 84 126 126 84 36 9 1

Perl, 47 54 characters
$p=1;map{print"@{[split//,$p]}\n";$p*=11}1..<>

It takes a number from the command line, but doesn't perform any error checks.
Just realized it only works up to n=4. It was some old code I had on my hd.
This works though:
map{@a=(1,map$a[$_-1]+=$a[$_],1..@a);print"@a\n"}a..n

n has to be input into the script though, or it would be one character more.

Pascal: 216 192 characters
(Not a real competitor, just an honorific presence.)
var p:array[0..1,0..25]of LongInt;i,j,n,u:Word;begin
Read(n);u:=0;for i:=1to n do begin
p[1,1]:=1;for j:=1to i do begin
p[u,j]:=p[1-u,j-1]+p[1-u,j];Write(p[u,j],' ')end;u:=1-u;Writeln
end
end.

Sample run:
bash-4.2$ fpc pascal.pas
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?

bash-4.2$ ./pascal <<< 1
1

bash-4.2$ ./pascal <<< 9
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1

APL, 19 15 characters
A bit late to the party, perhaps?
{⍪{⍵!⍨⍳⍵+1}¨⍳⍵}

It doesn't beat the J entry, though.
This assumes that the index origin (⎕IO) is set to 0. Unfortunately, with an index origin of 1, we need 25 18 characters:
{⍪{⍵!⍨0,⍳⍵}¨1-⍨⍳⍵}

There are two ⍨s in the code to express my frustration.
Demo:
      {⍪{⍵!⍨⍳⍵+1}¨⍳⍵}5
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1

Explanations
Short version:

⍳⍵ (with an index origin of 0) produces an array of the numbers from 0 to ⍵-1 inclusive, where ⍵ is the right argument to the function.
⍳⍵+1 generates all numbers from 0 to ⍵
{⍵!⍨⍳⍵+1} generates ⍵ choose k for every element k in ⍳⍵+1. The ⍨ (commute) operator swaps the arguments to a function around, such that the right hand argument becomes the left, and vice versa.
{⍵!⍨⍳⍵+1}¨⍳⍵ passes each element in ⍳⍵ using the ¨ (each) operator. The result is a one dimensional array containing the first ⍵ rows of the Pascal's Triangle.
The one argument form of ⍪ takes a one dimensional vector, and makes it a column rather than a row. Each row of the triangle is put on its own line.

Long answer:

Virtually the same as the other version, except that 1-⍨ is placed before an ⍳ to replicate an index origin of 0.
0,⍳⍵ with an index origin of 1 replicates ⍳⍵+1 with an index origin of 0.

Perl, 37 bytes
s/\d+/$&+$'/eg,say$_="1 $_"for($a)x<>

Try it online!

Perl, 77 Chars
$o[0]=1;for(1..<>){$"=" ";for(1..$_){$n[$_]=$o[$_]+$o[$_-1]}@o=@n;print"@o
"}

Example input
5

Example output
 1
 1 1
 1 2 1
 1 3 3 1
 1 4 6 4 1

C, 132 127 characters
c[25][25],n,i,j;main(){for(scanf("%d",&n);i<n;i++)for(j=0;j<=i;j++)printf("%d%c",c[i][j]=j?c[i-1][j-1]+c[i-1][j]:1,i-j?32:10);}

MATL, 10 bytes
Language created after this challenge
1iq:"tTTY+

Try it online!
1       % Push a 1. This will be the first row
iq:     % Take input n. Generate range [1,2,...,n-1]
"       % For each (that is, repeat n-1 times)
  t     %   Duplicate latest row
  TT    %   Push [1 1]
  Y+    %   Convolve latest row with [1 1] to produce next row
        % Implicitly end for each
        % Implicitly display stack contents

non-competing but a holy disaster, none from previous submissions (even J) succeeded to reduce it up to how much Matl did !!!

I'm pretty sure Jelly or 05AB1E would be shorter though :-)

JavaScript, 70 69 bytes
Generating Pascal's Triangle in a golfy manner has always given me brain ache but every time it comes up, I give it another try. Last night, armed with a few beers, I finally cracked it and came up with a working solution I was happy with. Fitting, then, that this should be my 500th (undeleted) solution here.
0-indexed and includes a trailing newline and a trailing space on each line.
n=>(g=x=>x++>n?``:(h=z=>y>x?``:z+` `+h(z*(x-y)/y++))(y=1)+`
`+g(x))``

Try it

o.innerText=(f=
n=>(g=x=>x++>n?``:(h=z=>y>x?``:z+` `+h(z*(x-y)/y++))(y=1)+`
`+g(x))``)(i.value=8);oninput=_=>o.innerText=f(+i.value)
<input id=i type=number><pre id=o></pre>

D 134 128 chars
import std.stdio;void main(){int n,m;int[]l,k=[0,1];readf("%d",&n);foreach(i;0..n){writeln(l=k~0);k=[];foreach(e;l)k~=m+(m=e);}}

output for 9 is
>9
[0, 1, 0]
[0, 1, 1, 0]
[0, 1, 2, 1, 0]
[0, 1, 3, 3, 1, 0]
[0, 1, 4, 6, 4, 1, 0]
[0, 1, 5, 10, 10, 5, 1, 0]
[0, 1, 6, 15, 20, 15, 6, 1, 0]
[0, 1, 7, 21, 35, 35, 21, 7, 1, 0]
[0, 1, 8, 28, 56, 70, 56, 28, 8, 1, 0]

taking full advantage of "you may format it however you like"; there is a space between each number and a linebreak
edit repositioned the assignment to l to shave of some chars

Scala, 131 characters
object P extends App{var x=List(1)
while(x.size<=args(0).toInt){println(x.mkString(" "))
x=(0+:x:+0).sliding(2).map(_.sum).toList}}

Takes the input from the command line.
Output for n=10:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
1 9 36 84 126 126 84 36 9 1

What's with all those 0s :-)?

@mellamokb Bit of re-arranging made them go away and shortened the code. :-)

F♯ - 203 characters
My first attempt at a round of code golf, and first attempt at functional programming. There is probably some obvious way to shorten it I haven't quite figured out yet. It complies in VS2010s F♯ compiler (which has the effect of running #light by default unlike earlier versions), and also works in the F♯ interpreter. Accepts input via stdin. Wish there was a better way for the input/output though! Lots of characters!
open System
let rec C r m =if r=0||m<=0||m>=r then 1 else C(r-1)m+C(r-1)(m-1)
for j = 0 to Convert.ToInt32(Console.ReadLine ()) do (
 [0..j]|>List.map(C j)|>List.iter(fun k->printf "%i " k)
 printf "\n")

Why is there no accepted answer to this question?
VBA - 249 chars
Sub t(n)
ReDim a(1 To n,1 To n*2)
a(1,n)=1:y=vbCr:z=" ":d=z & 1 & z & y:For b=2 To n:For c=1 To n*2:x=a(b-1,c)
If c>1 Then a(b,c)=a(b-1,c-1)+x
If c<n*2 Then a(b,c)=a(b-1,c+1)+x
d=IIf(a(b,c)<>0,d & z & a(b,c) & z,d):Next:d=d & y:Next:MsgBox d
End Sub

postscript - 59 chars (63 if you count -dn= to get the number of rows in)
[1]n{dup ==[0 3 2 roll{dup 3 2 roll add exch}forall]}repeat

run with
gs -q -dn=10 -dBATCH pascal.ps

to get
[1]
[1 1]
[1 2 1]
[1 3 3 1]
[1 4 6 4 1]
[1 5 10 10 5 1]
[1 6 15 20 15 6 1]
[1 7 21 35 35 21 7 1]
[1 8 28 56 70 56 28 8 1]
[1 9 36 84 126 126 84 36 9 1]

Mathematica 35 chars
Here is the dull and lazy way of slicing Pascal's triangle:
Table[n~Binomial~k,{n,0,5},{k,0,n}]

(* out *)
{{1}, {1, 1}, {1, 2, 1}, {1, 3, 3, 1}, {1, 4, 6, 4, 1}, {1, 5, 10, 10,5, 1}}

Maple, 46
seq(print(seq(binomial(i,k),k=0..i)),i=0..n-1)

Usage:
> f:=n->seq(print(seq(binomial(i,k),k=0..i)),i=0..n-1);
> f(3)
    1
   1 1
  1 2 1

VBA, 162 142 102 80 bytes
Saved 22 bytes thanks to Taylor Scott.
This is an old question now but I saw a shorter solution for VBA.
[B2].Resize([A1],[A1])="=IF(COLUMN()>ROW(),"""",IF(ROW()=2,1,IFERROR(A1+B1,1)))"

This is meant to be run in the immediate window. Input is in cell A1 of the active worksheet. Output is in the active worksheet starting at B2 and using however many cells are required based on the input. The COLUMN()>ROW() check keeps the top right of the triangle blank. The ROW()=2 check makes the first value 1 to initiate the triangle. I could have shifted the output down and dropped this check, but it introduces a lot of extraneous output before the actual triangle and I didn't feel that it was in the spirit of the challenge.
I originally posted a much more complicated method that calculated every value based on its row and column. All this method does, though, is to use in-cell formulas. I start at B2 so I can reference the row above it without #REF! errors. Then, it copies and pastes the same formula over a block of cells n wide and n tall. The input and output for n=25 looks like this:

Very cool answer, but you can golf this quite a bit. Converting Function p(r) to Sub p(r) since you have no function output value, removing the space from debug.? c(n,k); and converting the multiline if-then-else statement to a single line (If k Then c=c(n-1,k-1)*n/k Else c=1) brings the byte-count down to 130 by my count

@TaylorScott Thanks! I'm pretty new at golfing and only slightly less new to programming in general. I counted 142 because of the line breaks. From what I could find, those are supposed to count.

Ah, you are right, I did forget to count my newlines, and as it turns out, at least one other golfing trick For n=0 To... can be condensed to For n=0To... bringing my version of the code to Sub p(r):For n=0To r-1:For k=0To n:Debug.?c(n,k);:Next:Debug.?:Next:End Sub
Function c(n,k):If k Then c=1 Else c=c(n-1,k-1)*n/k [char(10)]
End Function with a byte count of 139

A second look at this suggests that if you break it down into an immediate window function with a helper function, you can get it down to 112 Bytes (Immediate Window Function: For n=0To[A1-1]:For k=0To n:?c(n,k);:Next:?:Next Helper Function: Function c(n,k)
If k Then c=c(n-1,k-1)*n/k Else c=1
End Function)

@TaylorScott I found an even shorter way using the immediate window. I had not previously considered the basic formula approach but it turned out to be way shorter.

since you moved over to a cell based response you can optimize this by removing the copy and instead always deleting [A:A] and [1:1] instead yielding [B2].Resize([A1],[A1])="=IF(COLUMN()>ROW(),"""",IFERROR(A1+B1,1))":[1:1].Delete:[A:A].Delete for 92 Bytes  - I tried golfing down the delete statements and I am convinced that there is a way to do it, but for now I cannot seem to condense them

@TaylorScott What about just dropping them entirely? With a change in the formula, it works just fine. I think that output starting at B2 instead of A1 is acceptable.

PHP, 66+1 bytes
for($a[]=1;$k||$argn>=$k=++$i;)echo$a[--$k]+=$a[$k-1],$k?" ":"
";

65+1 bytes in PHP 5.5 or later:
for($a=[1];$k||$argn>=$k=++$i;)echo$a[--$k]+=$a[$k-1],"
"[!$k];

Note that the first line has a trailing space!
Run as pipe with -nR or try them online.

K (ngn/k), 16 15 bytes
{x#x{+':x,0}\1}

Try it online!

Pip -s, 14 11 bytes
LaPl+:lPE!l

Try it online!
Explanation
Each row of the triangle, represented as a list, can be obtained by adding two copies of the previous row with an offset:
 [1 2 1]
+  [1 2 1]
----------
 [1 3 3 1]

Pip's default behavior when adding two lists is almost perfect: it matches up the elements and adds them pairwise, and if one list is longer, the extra numbers in that list are retained unchanged. So all we have to do is offset one list by prepending a 0:
 [1 2 1]
+[0 1 2 1]
----------
 [1 3 3 1]

Here's the version I started with before golfing:
Y[1]La{Pyy+:yPE0}
                   a is command-line argument (implicit)
Y[1]               Yank list representing the first row into y
    La{         }  Loop a times:
       Py           Print the current row (space-separated, thanks to -s flag)
            yPE0    Construct a list which is y with 0 prepended
         y+:        Add that to y and assign the result back to y

My original golfed version applied a few tricks:

Using this tip, [1] → ^1.
We can save the curly braces if the loop body is one statement, which we can accomplish by printing y in the expression that updates y: y+:(Py)PE0.
We can then save the parentheses by changing yPE0 (y with 0 prepended) to 0ALy (0 with the list y appended; 0 gets promoted to a singleton list [0] first). This leaves us with y+:0AL(Py), but since P is unary we can drop the parentheses (though we still need a space between the operators): y+:0AL Py.

The resulting solution is 14 bytes:
Y^1Lay+:0AL Py

But we can do better!

It would be nice to save the space before P; also, the initialization Y^1 is rather expensive.
If we could start from an empty list (as the "0th" row) and print each row after it is updated, we could solve both problems: we could use l (which is preinitialized to the empty list) instead of y, and the P would come immediately after the loop header and therefore not require a separator.
The problem is that our update logic, "prepend a 0 and add," doesn't work for the first row: it gives [] + [0] = [0], when we need [1].
But, if we can prepend a 1 on the first iteration and a 0 every other time, we'll be golden. On the first iteration, l is empty (falsey); on every other iteration, l is nonempty (truthy). So we can simply prepend !l.

This approach gives us our 11-byte solution:
LaPl+:lPE!l
La           Loop a times:
         !l   1 if l is empty, 0 otherwise
      lPE     Construct a list which is l with that value prepended
   l+:        Add that to l and assign the result back to l
  P           Print (space-separated: -s flag)

I knew mine wasn't the shortest, but not by this much.  What a clean solution.

05AB1E, 14 bytes
FN©>F®Ne})ˆ}¯»

Try it online!

1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1

Jelly, 17 bytes
3Bj+2\
1Ç⁸’¤Ð¡K€Y

Try it online!
If "provided however is most convenient in your chosen language" means that I can use 0-indexed input instead of 1-indexed, then ’¤ can be removed for -2.

R, 38 bytes
for(i in 0:scan())print(choose(i,0:i))

Try it online!
The other R answer is good, but this is shorter, and that one still needs a call to scan()!
In R, choose is vectorized over k so this is a neat solution. print also prints out the element number at the start of each line, so if that's not valid, I can change this to a 41 byte solution,
for(i in 0:scan())cat(choose(i,0:i),'\n')

I think you output one line too many every time (though neat solution indeed).

05AB1E, 8 bytes
<ÝεDÝc}»

Try it online!

I... you... I.... what?!

1¸=©sF®NF®«ü+®ì}®«=... I'm ashamed tbh lol. nCr, never seen it used until this answer.

@MagicOctopusUrn: I have used it before, but I can't remember in what/which answer(s). Sometimes I wish I had a searchable version of all answers that I could check when I feel like I've done something similar (and maybe better) in the past.

Maybe a search for all answers by user:## then extract all indented code blocks that follow a line starting with #[05AB1E] using the SE API :P?

I wanted to do that to find all questions with more than 1 05AB1E answer on it.

7 bytes by using a ranged loop without }.

Malbolge Unshackled (20-trit rotation variant), 3,2485e7 bytes
Size of this answer exceeds maximum postable program size (eh), so the code is located in my GitHub repository.
It's a slow monstrosity, but I love this one. The digits are being displayed in hexadecimal form.
Btw, the code is compressed using 7Zip and PPMd algorithm, because the program is plain too big to post to Github in it's state of art.
How to run this?
This might be a tricky part, because naive Haskell interpreter will take ages upon ages to run this. TIO has decent Malbogle Unshackled interpreter, but sadly I won't be able to use it (limitations).
The best one I could find is the fixed 20-trit rotation width variant, that performs very well.
To make the interpreter a bit faster, I've removed all the checks from Matthias Lutter's Malbolge Unshackled interpreter.
My modified version can run around 6,3% faster.
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

const char* translation = "5z]&gqtyfr$(we4{WP)H-Zn,[%\\3dL+Q;>U!pJS72Fh"
        "OA1CB6v^=I_0/8|jsb9m<.TVac`uY*MK'X~xDl}REokN:#?G\"i@";

typedef struct Word {
    unsigned int area;
    unsigned int high;
    unsigned int low;
} Word;

void word2string(Word w, char* s, int min_length) {
    if (!s) return;
    if (min_length < 1) min_length = 1;
    if (min_length > 20) min_length = 20;
    s[0] = (w.area%3) + '0';
    s[1] = 't';
    char tmp[20];
    int i;
    for (i=0;i<10;i++) {
        tmp[19-i] = (w.low % 3) + '0';
        w.low /= 3;
    }
    for (i=0;i<10;i++) {
        tmp[9-i] = (w.high % 3) + '0';
        w.high /= 3;
    }
    i = 0;
    while (tmp[i] == s[0] && i < 20 - min_length) i++;
    int j = 2;
    while (i < 20) {
        s[j] = tmp[i];
        i++;
        j++;
    }
    s[j] = 0;
}

unsigned int crazy_low(unsigned int a, unsigned int d){
    unsigned int crz[] = {1,0,0,1,0,2,2,2,1};
    int position = 0;
    unsigned int output = 0;
    while (position < 10){
        unsigned int i = a%3;
        unsigned int j = d%3;
        unsigned int out = crz[i+3*j];
        unsigned int multiple = 1;
        int k;
        for (k=0;k<position;k++)
            multiple *= 3;
        output += multiple*out;
        a /= 3;
        d /= 3;
        position++;
    }
    return output;
}

Word zero() {
    Word result = {0, 0, 0};
    return result;
}

Word increment(Word d) {
    d.low++;
    if (d.low >= 59049) {
        d.low = 0;
        d.high++;
        if (d.high >= 59049) {
            fprintf(stderr,"error: overflow\n");
            exit(1);
        }
    }
    return d;
}

Word decrement(Word d) {
    if (d.low == 0) {
        d.low = 59048;
        d.high--;
    }else{
        d.low--;
    }
    return d;
}

Word crazy(Word a, Word d){
    Word output;
    unsigned int crz[] = {1,0,0,1,0,2,2,2,1};
    output.area = crz[a.area+3*d.area];
    output.high = crazy_low(a.high, d.high);
    output.low = crazy_low(a.low, d.low);
    return output;
}

Word rotate_r(Word d){
    unsigned int carry_h = d.high%3;
    unsigned int carry_l = d.low%3;
    d.high = 19683 * carry_l + d.high / 3;
    d.low = 19683 * carry_h + d.low / 3;
    return d;
}

// last_initialized: if set, use to fill newly generated memory with preinitial values...
Word* ptr_to(Word** mem[], Word d, unsigned int last_initialized) {
    if ((mem[d.area])[d.high]) {
        return &(((mem[d.area])[d.high])[d.low]);
    }
    (mem[d.area])[d.high] = (Word*)malloc(59049 * sizeof(Word));
    if (!(mem[d.area])[d.high]) {
        fprintf(stderr,"error: out of memory.\n");
        exit(1);
    }
    if (last_initialized) {
        Word repitition[6];
        repitition[(last_initialized-1) % 6] =
                ((mem[0])[(last_initialized-1) / 59049])
                    [(last_initialized-1) % 59049];
        repitition[(last_initialized) % 6] =
                ((mem[0])[last_initialized / 59049])
                    [last_initialized % 59049];
        unsigned int i;
        for (i=0;i<6;i++) {
            repitition[(last_initialized+1+i) % 6] =
                    crazy(repitition[(last_initialized+i) % 6],
                        repitition[(last_initialized-1+i) % 6]);
        }
        unsigned int offset = (59049*d.high) % 6;
        i = 0;
        while (1){
            ((mem[d.area])[d.high])[i] = repitition[(i+offset)%6];
            if (i == 59048) {
                break;
            }
            i++;
        }
    }
    return &(((mem[d.area])[d.high])[d.low]);
}

unsigned int get_instruction(Word** mem[], Word c,
        unsigned int last_initialized,
        int ignore_invalid) {
    Word* instr = ptr_to(mem, c, last_initialized);
    unsigned int instruction = instr->low;
    instruction = (instruction+c.low + 59049 * c.high
            + (c.area==1?52:(c.area==2?10:0)))%94;
    return instruction;
}

int main(int argc, char* argv[]) {
    Word** memory[3];
    int i,j;
    for (i=0; i<3; i++) {
        memory[i] = (Word**)malloc(59049 * sizeof(Word*));
        if (!memory) {
            fprintf(stderr,"not enough memory.\n");
            return 1;
        }
        for (j=0; j<59049; j++) {
            (memory[i])[j] = 0;
        }
    }
    Word a, c, d;
    unsigned int result;
    FILE* file;
    if (argc < 2) {
        // read program code from STDIN
        file = stdin;
    }else{
        file = fopen(argv[1],"rb");
    }
    if (file == NULL) {
        fprintf(stderr, "File not found: %s\n",argv[1]);
        return 1;
    }
    a = zero();
    c = zero();
    d = zero();
    result = 0;
    while (!feof(file)){
        unsigned int instr;
        Word* cell = ptr_to(memory, d, 0);
        (*cell) = zero();
        result = fread(&cell->low,1,1,file);
        if (result > 1)
            return 1;
        if (result == 0 || cell->low == 0x1a || cell->low == 0x04)
            break;
        instr = (cell->low + d.low + 59049*d.high)%94;
        if (cell->low == ' ' || cell->low == '\t' || cell->low == '\r'
                || cell->low == '\n');
        else if (cell->low >= 33 && cell->low < 127 &&
                (instr == 4 || instr == 5 || instr == 23 || instr == 39
                    || instr == 40 || instr == 62 || instr == 68
                    || instr == 81)) {
            d = increment(d);
        }
    }
    if (file != stdin) {
        fclose(file);
    }
    unsigned int last_initialized = 0;
    while (1){
        *ptr_to(memory, d, 0) = crazy(*ptr_to(memory, decrement(d), 0),
                *ptr_to(memory, decrement(decrement(d)), 0));
        last_initialized = d.low + 59049*d.high;
        if (d.low == 59048) {
            break;
        }
        d = increment(d);
    }
    d = zero();

    unsigned int step = 0;
    while (1) {
        unsigned int instruction = get_instruction(memory, c,
                last_initialized, 0);
        step++;
        switch (instruction){
            case 4:
                c = *ptr_to(memory,d,last_initialized);
                break;
            case 5:
                if (!a.area) {
                    printf("%c",(char)(a.low + 59049*a.high));
                }else if (a.area == 2 && a.low == 59047
                        && a.high == 59048) {
                    printf("\n");
                }
                break;
            case 23:
                a = zero();
                a.low = getchar();
                if (a.low == EOF) {
                    a.low = 59048;
                    a.high = 59048;
                    a.area = 2;
                }else if (a.low == '\n'){
                    a.low = 59047;
                    a.high = 59048;
                    a.area = 2;
                }
                break;
            case 39:
                a = (*ptr_to(memory,d,last_initialized)
                        = rotate_r(*ptr_to(memory,d,last_initialized)));
                break;
            case 40:
                d = *ptr_to(memory,d,last_initialized);
                break;
            case 62:
                a = (*ptr_to(memory,d,last_initialized)
                        = crazy(a, *ptr_to(memory,d,last_initialized)));
                break;
            case 81:
                return 0;
            case 68:
            default:
                break;
        }

        Word* mem_c = ptr_to(memory, c, last_initialized);
        mem_c->low = translation[mem_c->low - 33];

        c = increment(c);
        d = increment(d);
    }
    return 0;
}

It's working (very slowly!)

Japt -R, 16 13 bytes
_ä+T p1}h[1â]

Try it
_äÈ+Y}0 p1}      // f = prepend 0 to array and sums each pairs, then appends 1
           h[1â] // run f input times starting with [[1]]

saved 3 thanks to @Shaggy

ä+T will work here, too.

Pip -s, 22 21 bytes
La{PooMP:_+BoPU1oPB1}

Try it online!
This was simpler than trying to map an iterable, and probably shorter.
-1 byte from Dlosc, using the PU and PB functions.
Explanation (old)
La{Poo:1AL(_+BMPo)AL1} a → input, o → 1(predefined)
La{                  } loop a times
   Po                  print variable o(joined by spaces due to -s)
     o:                assign o to:
          (_+BMPo)     sums of pairs of it's elements
       1AL        AL1  with 1 added on both sides

I just remembered that PU and PB return lvalues, so: 19 bytes.

Forth (gforth), 58 53 bytes
: P 0 ?do 1 i for dup . i * j i - 1+ / next cr loop ;

Try it online!
This is a heavily shortened version of the implementation here, which was in turn, translated from C.
-5 bytes from Bubbler.
The function is called like: <input> P.

When you need to loop from 0 to n inclusive, for loop can be shorter.

Scala, 58 bytes
Seq.iterate(Seq(1),_){r=>1+:(r,r.tail).zipped.map(_+_):+1}

Try it online!
Somewhat based upon this other Scala answer.
Seq.iterate(                 //Make a Seq
  Seq(1),                      //starting with just [1]
  _                            //of length n (_ is shorthand for n=>...n...
){ r =>                      //Function to get next row from previous row r
  (r,r.tail).zipped.map(_+_)    //Add each cell with the one on its right
1+:                         :+1 //Put two 1's around it
}

Scala 3, 54 bytes
Seq.iterate(Seq(1),_){r=>1+:r.zip(r.tail).map(_+_):+1}

Try it online!

Google Sheets, 58
Input in arbitrary cell. Assign it named range "N". (+1 count)
Then use
=ArrayFormula(IFERROR(COMBIN(SEQUENCE(N,1,),SEQUENCE(1,N,

Vyxal Mj, 4 bytes
ƛʀƈṄ

Try it Online!
-2 bytes thanks to Lyxal

The : is unnecessary.

4 bytes

Raku, 31 bytes
{1,{.put;|$_,0 Z+0,|$_}...$_+1}

Try it online!

PHP, 105 92 characters
for($e=1;$e++<=$i;$n=$a,$a=''){
foreach($n as $k=>$v)$a[]=$v+$n[$k-1];
$a[]=1;print_r($a);}

Input: $i = 9;
Output:
Array
(
    [0] => 1
)
Array
(
    [0] => 1
    [1] => 1
)
Array
(
    [0] => 1
    [1] => 2
    [2] => 1
)
Array
(
    [0] => 1
    [1] => 3
    [2] => 3
    [3] => 1
)
Array
(
    [0] => 1
    [1] => 4
    [2] => 6
    [3] => 4
    [4] => 1
)
Array
(
    [0] => 1
    [1] => 5
    [2] => 10
    [3] => 10
    [4] => 5
    [5] => 1
)
Array
(
    [0] => 1
    [1] => 6
    [2] => 15
    [3] => 20
    [4] => 15
    [5] => 6
    [6] => 1
)
Array
(
    [0] => 1
    [1] => 7
    [2] => 21
    [3] => 35
    [4] => 35
    [5] => 21
    [6] => 7
    [7] => 1
)
Array
(
    [0] => 1
    [1] => 8
    [2] => 28
    [3] => 56
    [4] => 70
    [5] => 56
    [6] => 28
    [7] => 8
    [8] => 1
)

nice one, though predefined variables are no valid input method.

Python 105 chars
A=[1]
for i in range(input()):
    B=[sum(A[j:j+2])for j in range(i)]
    B[:0]=[1]
    B[i+1:]=[1]
    print A
    A=B

You can spare 4 characters with list slice: replace B.insert(0,1) with B[:0]=[1].

Yeah! I'm not a very advanced python programmer. And I've changed both of them.

C, 108 (126)
Length depends on whether the #include can be omitted, as it is some other C examples. Code uses edk.h as the shortest (Microsoft) standard C header with stdio.h included.
#include <edk.h>
int a[25]={1},b,c,d;main(){for(scanf("%d",&d);c++<d;)for(b=c;b--;printf("%d%c",a[b],b?32:10),a[b+1]+=a[b]);}

Prolog (SWI), 124 118 114 bytes
r([A,B|R],[C|S]):-C is A+B,r([B|R],S).
r(L,L).
t(L,I):-I=0;write(L),nl,r([0|L],M),J is I-1,t(M,J).
t(N):-t([1],N).

The predicate t(N) outputs N rows of Pascal's triangle. Try it online!
Note that if you're running this locally, Prolog will probably tell you there's more than one result; if you ask for the next result, it might either output some invalid row(s) or print ever-increasing rows of the triangle till it crashes. I don't think this invalidates the solution, since it behaves exactly as desired on TIO. At any rate, a 4-byte fix is to add a couple of "cuts": insert ,! before the period at the end of line 1, and again after I=0 in line 3.
Ungolfed, with comments
% nextRow/2 takes the current row (with a zero prepended) and builds the next row
% Example: nextRow([0, 1, 2, 1], X) gives X = [1, 3, 3, 1]

% Base case: we've gotten down to the final 1, which stays the same in the next row
nextRow([1], [1]).
% Recursive case: an element in the next row is the sum of the two elements
% above it in the current row
nextRow([A, B | Tail], [C | NewTail]) :- C is A+B, nextRow([B | Tail], NewTail).

% triangle/2 takes the current row and the number of rows left and outputs that
% many rows

% Base case: no rows left; we're done
triangle(_, 0) :- !.
% Recursive case: output the current row, build the next row, and recurse with
% decremented number of rows left
triangle(Row, RowsLeft) :-
  write(Row), nl,
  nextRow([0 | Row], NewRow),
  NewRowsLeft is RowsLeft-1,
  triangle(NewRow, NewRowsLeft).

% triangle/1 takes the number of rows N and outputs that many rows starting from [1]

triangle(N) :- triangle([1], N).

Pyt, 9 bytes
If the output format was less restrictive, then this could be 8 bytes (just remove 'Á')
řĐř⁻⇹⁻⇹ćÁ

Explanation:
               Implicit input (n)
ř              Push [1,2,...,n]
 Đ             Duplicate top of stack
  ř            Push [[1],[1,2],[1,2,3],...,[1,2,...,n]]
   ⁻           Decrement element-wise [[0],[0,1],[0,1,2],...,[0,1,...,n-1]]
    ⇹          Swap top two elements on stack
     ⁻         Decrement [0,1,2,...,n-1]
      ⇹        Swap top of stack
       ć       Compute nCr†
        Á      Push contents of array on top of stack to the stack

Try it online!
† - This yields [[0C0],[1C0,1C1],[2C0,2C1,2C2],...,[(n-1)C0,(n-1)C1,...,(n-1)C(n-1)]]

Java 10, 143 138 bytes
r->{var s="";for(int i=0,j;i++<r;s+="\n")for(j=0;j++<i;s+=p(i,j)+" ");return s;}int p(int r,int k){return--r<1|k<2|k>r?1:p(r,k-1)+p(r,k);}

-2 bytes thanks to @ceilingcat.
Explanation:
Try it online.
r->{                     // Method with integer parameter and String return-type
  var s="";              //  Result-String, starting empty
  for(int i=0,j;i++<r;   //  Loop `i` in the range [1, `r`]:
      s+="\n")           //    After every iteration: Append a new-line
    for(j=0;j++<i;       //   Inner loop `j` in the range [1, `i`]:
      s+=p(i,j)          //    Append the `j`'th Pascal Triangle number on the `i`'th row
         +" ");          //    and also append a space
  return s;}             //  Return the result-String

// Separated recursive method to get the k'th value of the r'th row in the Pascal Triangle
int p(int r,int k){return--r<1|k<2|k>r?1:p(r,k-1)+p(r,k);}

Python 3, 68 Bytes
b=lambda n,a=[1]:n and[print(a),b(n-1,[*map(sum,zip([0]+a,a+[0]))])]

Scala, 97 bytes
n=>{var p=Seq(1);for(i<-0 to n-1){println(p mkString " ");p=1+:0.to(i-1).map(j=>p(j)+p(j+1)):+1}}

A for loop computes the next line's number sequence from the previous one via simple index-based addition and by concatenating 1's via +: and :+. Unfortunately this iterative approach is slightly shorter than a "nicer" monadic approach via scanLeft :)
Edit: Thanks to all commentors for tips & corrections!
Try it online!

I don't think you can accept input through variables that aren't passed to a function. Luckily, it only costs 2 bytes more if you golf it some more.

You can actually get 71 bytes using scanLeft.

Julia 0.7, 37 bytes
f(x)=@show 1(x<2||[0;F=f(x-1)]+[F;0])

Try it online!
It outputs a lot of garbage but it's allowed:
1 * (x < 2 || [0; F = f(x - 1)] + [F; 0]) = 1
1 * (x < 2 || [0; F = f(x - 1)] + [F; 0]) = [1, 1]
1 * (x < 2 || [0; F = f(x - 1)] + [F; 0]) = [1, 2, 1]
1 * (x < 2 || [0; F = f(x - 1)] + [F; 0]) = [1, 3, 3, 1]
1 * (x < 2 || [0; F = f(x - 1)] + [F; 0]) = [1, 4, 6, 4, 1]

Jelly, 8 bytes
ḶcŻ$€K€Y

Try it online!
Mmm yes the output format here really do be fun tho - 5 bytes for the triangle generation, and 3 for the formatting.
Explained
ḶcŻ$€K€Y # A monadic chain with argument n. Let the current value be λ
Ḷ        # λ = [0, n)
    €    # over each item in λ:
 cŻ$     #   yield item choose [0, item] (vectorising)
     K€  # join each sublist on spaces
       Y # and join that on newlines

The output format is somewhat lenient here, so G works in place of K€Y.

5 bytes

Excel, 48 bytes
Takes input \$n\$ from cell A1 and outputs an \$n\times n\$ lower triangular matrix as a spilled array to the calling cell.
=IfError(Combin(Sequence(A1),Sequence(1,A1)),"")

Fig, \$19\log_{256}(96)\approx\$ 15.639 bytes
#jej/ #GWW1O'+Jx0J0

Try it online!

Thunno 2 N, 8 bytes
LıDĖ€cðj

Attempt This Online!
But, if outputting a nested list was ok:
Thunno 2, 6 bytes
LıDĖ€c

Attempt This Online!
Explanation
LıDĖ€cðj  # Implicit input
Lı        # Map over the range [0..input)
  D       #  Duplicate the current number
   Ė€     #  Map over the range [0..number]
     c    #   Compute the binomial coefficient
      ðj  #  Join the row by spaces
          # Implicit output, joined by newlines

Perl, 111 characters
I know this can be improved on, just a first try:
$r=<>;
@p=(1);
while($r--){
    print join(' ',@p)."\n";
    @q=@p;
    unshift @q,0;
    push @p,0;
    $i=0;
    foreach(@p){$_+=$q[$i++];}
}

Axiom 64 bytes
p(n)==for j in 0..n-1 repeat output[binomial(j,i) for i in 0..j]

results
(74) -> p 1
   Compiling function p with type PositiveInteger -> Void
   [1]
                                                               Type: Void
(75) -> p 2
   [1]
   [1,1]
                                                               Type: Void
(76) -> p 9
   [1]
   [1,1]
   [1,2,1]
   [1,3,3,1]
   [1,4,6,4,1]
   [1,5,10,10,5,1]
   [1,6,15,20,15,6,1]
   [1,7,21,35,35,21,7,1]
   [1,8,28,56,70,56,28,8,1]
                                                               Type: Void

C, 178 bytes
#define x p[i][j]
p[25][51]={0};i;j;f(n){p[0][25]=1;for(i=1;i<n;i++)for(j=1;j<50;j++)x=p[i-1][j-1]+p[i-1][j+1];for(i=0;i<n;i++,putchar(10))for(j=0;j<51;j++)if(x)printf("%d ",x);}

Uniformly Padded, 244 bytes
#define x p[i][j]
s[25]={1,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,5,5,5,5,6,6,6,7,7};p[25][51]={0};i;j;f(n){p[0][25]=1;for(i=1;i<n;i++)for(j=1;j<50;j++)x=p[i-1][j-1]+p[i-1][j+1];for(i=0;i<n;i++,putchar(10))for(j=0;j<51;j++)if(x)printf("%*d ",s[n-1],x);}

Live Demo
Detailed
#include <stdio.h>

int main(void)
{
    int n = 15;
    int s[25]={1,1,1,1,1, 2,2,2,2, 3,3,3,3, 4,4,4, 5,5,5,5, 6,6,6, 7,7};
    int p[25][25+1+25] = { 0 };
    p[0][25] = 1;

    for(int i = 1; i < n; i++)
    {
        for(int j = 1; j < (25+1+24); j++)
        {
            p[i][j] = p[i-1][j-1] + p[i-1][j+1];
        }
    }

    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < (25+1+25); j++)
        {
            if(p[i][j])
            {
                printf("%*d ",s[n-1],p[i][j]);
            }
        }
        printf("\n");
    }

    return 0;
}

Husk, 17 bytes
¶↑:;1´o¡ȯmΣ∂Ṫ*´e1

Try it online!
Explanation
Idea is to use polynomial multiplication beginning with [1,1] and iterate multiplication, take N elements from the resulting infinite list:
¶↑:;1´(¡(mΣ∂Ṫ*))´e1  -- implicit input N
                ´e1  -- duplicate 1 & listify: [1,1]
     ´(        )     -- duplicate [1,1] and apply to:
       ¡(mΣ∂Ṫ*)      --   iterate the function (see below*)
                     -- [[1,1],[1,2,1],[1,3,3,1],…
   ;1                -- listify 1: [1]
  :                  -- prepend: [[1],[1,1],[1,2,1],[1,3,3,1],…
 ↑                   -- take N elements
¶                    -- join with newlines

* That function handles the multiplication, as described here.

Pyth, 6 bytes
m.cLdh

Try it online!

Code    |Explanation
--------+------------------------------
m.cLdh  |Full code
m.cLdhdQ|With implicit variables filled
--------+------------------------------
m      Q|For each d in [0, input):
   L hd | For each k in [0, d]:
 .c d   |  dCk
   L    | Collect results in a list
m       |Collect results in a list
        |Print result (implicit)

jq -r, 50 bytes
limit(.;[1]|recurse([.[-1,keys[]:][:2]|add]))|@tsv

Try it online!

C, 311 bytes
r(int*s,int*o,int n){int h=1;while(h<=n){if(h==2){printf("%d %d\n",1,1);o[0]=1;o[1]=1;}else if(h==1){printf("%d\n",1);o[0]=1;}else{int j=0;int*s_p=s,*o_p=o;*o_p++=1;printf("1 ");while(j<(h-2)){*o_p+=*s_p++;*o_p+++=*s_p;printf("%d ",*(o_p-1));j++;}*o_p=1;printf("1\n");}memcpy(s,o,100);memset(o,0,100);h++;}}

The complete, readable version of the program is below:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void row(int *s,int *o,int n)
{   int h = 1;

    while (h <= n)
    {

    if(h==2){printf("%d %d\n",1,1);o[0]=1;o[1]=1;}

    else if(h==1){printf("%d\n",1);o[0]=1;}

    else
    {
        int j = 0; int *s_p=s,*o_p=o;*o_p++ =1;printf("1 ");

        while(j<(h-2))
        {
            *o_p += *s_p++;

            *o_p++ += *s_p;

            printf("%d ",*(o_p-1));

            j++;
        }

        *o_p=1;printf("1 ");puts("");
    }
        memset(s,0,100);memcpy(s,o,100);memset(o,0,100);h++;

    }

}

int main(int argc,char ** argv)
{
    const int n = strtol(argv[1],0,10);

    row(n);
}

You can use a shorter function name to save some bytes.

I renamed the function to r. Thanks.

Extra whitespace, long variable names, unecessary parentheses, lists can be declared outside the function to remove the static int, first memset is not needed, 100s can be 99, the puts can be combined with the printf, second o[0]=1; can be removed

Got rid of the first memset and unnecessary puts. I don't know what you mean by replacing 100 with 99 because if n == 25 and since sizeof(int)==4, then I think it should remain a 100.

You don't need to reset the last element since you don't need to support the 26th iteration. Why did you put the lists back in the input? The question only specifies n as input, and you aren't using them as output? You still have the long variable names and the extra o[0]=1

Your complete version of the code does not work


text:
Maclaurin series of Black Box Function
Given a Black Box function ff that takes a single floating-point parameter, write a function M to generate the Maclaurin series for that function, according to the following specifications:

take a parameter n, and generate all terms from x^0 to x^n where 0 <= n <= 10
coefficients for each term should be given to at least 5 decimal places for non-integral values; underflows can simply be ignored or replaced with 0 and left out if you wish, or you can use scientific notation and more decimal places
assume ff is a continuous function and everywhere/infinitely differentiable for x > -1, and returns values for input x in the range: -10^9 <= ff(x) <= 10^9
programming languages with functions as first-class data types can take ff as a parameter; all other languages assume a function called ff has already been defined.
output should be formatted like # + #x + #x^2 + #x^5 - #x^8 - #x^9 ..., i.e., terms having 0 coefficient should be left out, and negative coefficients should be written - #x^i instead of + -#x^i; if the output terms are all zero, you can output either 0 or null output
output can be generated either to stdout or as a return value of type string from the function

Examples (passing ff as a first parameter):
> M(x => sin(x), 8)
x - 0.16667x^3 + 0.00833x^5 - 0.00020x^7
> M(x => e^x, 4)
1 + x + 0.5x^2 + 0.16667x^3 + 0.04167x^4
> M(x => sqrt(1+x), 4)
1 + 0.5x - 0.125x^2 + 0.0625x^3 - 0.03906x^4
> M(x => sin(x), 0)
0 (or blank is also accepted)

I'm not clear what the function is supposed to do in languages without a REPL. Does it print to stdout, return a string, or whichever is more convenient for me? Also, is there an omitted special case whereby if the parameters are all 0 the output should not exclude the constant term?

Output method is not specified, as long as it's formatted according to the spec given.  I'm a fan of avoiding stdin/stdout disadvantages.  As far as when all output is 0, it would be fine to generate blank output or 0 either one.  I'll make those both clear, thanks!

One of your examples is sqrt(1+x), but you allowed us to assume that ff is continuous and everywhere differentiable.

Updated: everywhere/infinitely differentiable for x > -1.  My goal was that caring about discontinuities would not be part of the problem, but in the case of sqrt(1+x), I had just lifted off of the samples on the Wiki page without thinking.  I believe you can find the answer as long as ff is infinitely differentiable in at least small range centered around 0.

Ruby, 173 chars
M=->n{r=(-n..n).map{|x|ff(x/2e2)};((0..n).map{|t|u=r[n-t];t<n&&r=r[2..-1].zip(r).map{|x,y|(x-y)*1e2/(t+1)};u.abs<1e-5?'':'%+.5f'%u+(t<2??x[0,t]:'x^%d'%t)}*'').sub(/^\+/,'')}

Unfortunately this approach is similar to Keith's solution and thus also numerically unstable for large n.
def ff(x) Math.sin(x) end
puts M[8]  # 1.00000x-0.16666x^3+0.00833x^5-0.00020x^7

def ff(x) Math.exp(x) end
puts M[4]  # 1.00000+1.00000x+0.50000x^2+0.16667x^3+0.04167x^4

def ff(x) Math.sqrt(1+x) end
puts M[4]  # 1.00000+0.50000x-0.12500x^2+0.06251x^3-0.03907x^4

def ff(x) Math.sin(x) end
puts M[0]  # <empty line>

I think it's less that the approach is numerically unstable and more that the problem is ill-conditioned. As a rough estimate, based on extrapolating the condition numbers of the inverse Vandermonde matrices for the simple polynomial fit approach, 8 significant decimal digits is as much as it's reasonable to hope for when n=8 even assuming infinite precision for the intermediate results.

Python, 188 chars
D=lambda f:lambda x:100*(f(x+.005)-f(x-.005))
def M(f,n):
 s="";d=1
 for i in xrange(n+1):
  c=f(0)/d;f=D(f);d*=i+1
  if c:s+='%+.5f'%c+['','x','x^%d'%i][(i>0)+(i>1)]
 print s[s[:1]=='+':]

This code takes lots of liberties with accuracy and numerical stability, but it generates something close to the right answer for the given examples.
Running it:
import math
M(lambda x:math.sin(x),8)
M(lambda x:math.exp(x),4)
M(lambda x:math.sqrt(x+1),4)
M(lambda x:math.sin(x),0)

gives:
1.00000x-0.16666x^3+0.00833x^5-0.00020x^7
1.00000+1.00000x+0.50000x^2+0.16667x^3+0.04167x^4
1.00000+0.50000x-0.12500x^2+0.06251x^3-0.03907x^4
<a blank line>

GCC, 549 chars
#define f __float128
#define D long double
#define L(v)for(v=0;v<n;v++)
void G(f a[],int n,double d){f m[n][n],s;int
i,j,k;L(i)L(j)m[i][j]=j?m[i][j-1]*d*(i-n/2):1;L(i){s=m[i][i];L(j)m[i][j]/=s;a[i]/=s;L(j)if(j^i){s=m[j][i];L(k)m[j][k]-=s*m[i][k];a[j]-=s*a[i];}}}
#define F(a)L(i)a[i]=(f)ff(d*(i-n/2));G(a,n,d);
void M(int n){f p[++n],q[n];double d=1;int
i,j=1;F(p)while(j){d/=2;F(q)j=0;L(i){j|=(p[i]-q[i])>1E-7;p[i]=q[i];}}L(i)if(p[i]<-5E-6){printf("- %.5Lfx^%d ",(D)-p[i],i);j=1;}else if(p[i]>5E-6){printf("%s%.5Lfx^%d ",j?"+ ":"",(D)p[i],i);j=1;}}

Example usage (ungolfed):
#include <math.h>
#include <stdio.h>

double ff(double x)
{
    return sin(x);
}

#define f __float128
#define D long double
#define L(v) for(v=0;v<n;v++)
void G(f a[],int n,double d) {
    f m[n][n],s;
    int i,j,k;
    L(i) L(j) m[i][j] = j ? m[i][j-1]*d*(i-n/2) : 1;
    L(i) {
        s=m[i][i]; L(j) m[i][j]/=s; a[i]/=s;
        L(j) if(j^i) {
            s=m[j][i]; L(k) m[j][k]-=s*m[i][k]; a[j]-=s*a[i];
        }
    }
}
#define F(a) L(i) a[i]=(f)ff(d*(i-n/2)); G(a,n,d);
void M(int n) {
    f p[++n],q[n];
    double d=1;
    int i,j=1;

    F(p)
    while(j) {
        d/=2;
        F(q)
        j=0;
        L(i) {
            j|=(p[i]-q[i])>1E-7;
            p[i]=q[i];
        }
    }

    L(i)
        if (p[i]<-5E-6) { printf("- %.5Lfx^%d ",(D)-p[i],i); j=1; }
        else if (p[i]>5E-6) { printf("%s%.5Lfx^%d ",j?"+ ":"",(D)p[i],i); j=1; }
}

void main()
{
    M(8);
}

Compiles with just gcc maclaurin.c -lm
I'm sure that someone who actually knows C can shave at least 10% off, but if nothing else it gets the ball rolling.
With a bit of playing with matrix inverses I've discovered a shorter, but less numerically stable, method which exploits the particular structure of the matrices to special-case the Gaussian elimination:
Alternate, 536 chars
#define f __float128
#define D long double
#define L(v)for(v=0;v<n;v++)
void G(f a[],int n,double d){int i,t;f F[n];L(i)F[i]=i?i*F[i-1]:1;while(--n>0){f c=0;t=2*(n&1)-1;for(i=0;i<=n;i++){t=-t;c+=t*a[i]/F[i]/F[n-i];}L(i)a[i]-=c*pow(i,n);L(i)c/=d;a[n]=c;}}
#define F(a)L(i)a[i]=(f)ff(d*i);G(a,n,d);
void M(int n){f p[++n],q[n];double d=.5;int i,j=1;F(p)while(j){d/=2;F(q)j=0;L(i){j|=(p[i]-q[i])>1E-7;p[i]=q[i];}}L(i)if(p[i]<-5E-6){printf("- %.5Lfx^%d ",(D)-p[i],i);j=1;}else if(p[i]>5E-6){printf("%s%.5Lfx^%d ",j?"+ ":"",(D)p[i],i);j=1;}}

However, this really needs a better error check, so that when it hits the point at which the largest term in the polynomial starts blowing out of control it will quit the loop.

Mathematica, 39 chars
InputForm@N@Normal@Series[#1,{x,0,#2}]&

Usage
%[Sin[x], 8]

Output
x - 0.16666666666666666*x^3 + 0.008333333333333333*x^5 - 0.0001984126984126984*x^7

While correct, this answer involves knowledge of the function itself to generate the series.  The idea behind the question is assuming the only thing you can know are input/output pairs of the function, and not what the original function actually is.

@mellamokb No, your interpretation is not correct. #1 is the function (black box, as requested), and is a parameter. See usage example above and compare with the first example in the question.

I understand that.  I mean the Mathematica engine could make use of symbolic math to generate the series.  I can't tell from your example whether it is making limit approximations, or just calculating the derivatives directly from the input.  In any case, Mathematica is probably too high-level for this problem, since it's involving direct calculation of limits and calculating the series completely manually.

@mellamokb calculating the series completely manually is not stated in the Q. Anyway, the best suited the language for the problem, the least fun (but the better golf).

That's the whole point / challenge of the question.  It's implicit simply because in most programming languages, Sin[x] is not understood in any semantic sense by the language other than knowing how to perform the calculation on a given input.  Since Mathematica can interpret Sin[x] at a higher-level than just numeric calculation, that implicit expectation breaks down.  I would feel the same way, for example, to a solution given in TI-89 Basic as Taylor(ff, x, 1, 8).  So ff is passed in instead of directly put in as an argument; it's still no challenge.  Anyway +1 for a correct answer :)

source: Stack Exchange

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

sort: votes


text:
Create a function for transposing musical chords
Your mission is to create a function for transposing music chords.
Copied from SO with permission of the original asker, I just really wanted to see what you guys could do with this one:
Since I don't expect everyone to be a musician here, I'll try to explain how it works in music theory. I hope I don't forget something. If yes, musicians, please, correct me.
1) The simple chords
The simple chords are almost as simple as an alphabet and it goes like this:

C, C#, D, D#, E, F, F#, G, G#, A, A# B

From B it loops all over again to C. Therefore, If the original chord is E and we want to transpose +1, the resulting chord is F. If we transpose +4, the resulting chord is G#.
2) Expanded chords
They work almost like the simple chords, but contain a few more characters, which can safely be ignored when transposing. For example:

Cmi, C#7, Dsus7, Emi, Fsus4, F#mi, G ...

So again, as with the simple chords, if we transpose Dsus7 + 3 = Fsus7
3) Non-root bass tone
A problem arises when the bass plays a different tone than the chord root tone. This is marked by a slash after the chord and also needs to be transposed. Examples:

C/G, Dmi/A, F#sus7/A#

As with examples 1 and 2, everything is the same, but the part after the slash needs transpose too, therefore:
C/G + 5 = F/C
F#sus7/A# + 1 = Gsus7/B
I think this should be all, unless I forgot something.
So basically, imagine you have a javascript variable called chord and the transpose value transpose. What code would transpose the chord?
Example:
var chord = 'F#sus7/C#';
var transpose = 3; // remember this value also may be negative, like "-4"
... code here ...
var result; // expected result = 'Asus7/E';

original question here: https://stackoverflow.com/questions/7936843/how-do-i-transpose-music-chords-using-javascript (note that he's asking for JS, for this challenge I don't care what language its in)

Haskell, 146
c=zip(words"C C# D D# E F F# G G# A A# B")[0..]
x#n=maybe x(\i->fst$c!!mod(i+n)12)$lookup x c
(x:'#':y)%n=(x:"#")#n++y%n
(x:y)%n=[x]#n++y%n
x%_=x

This defines an operator % that transposes a chord by a given amount, so you'd use it like this:
*Main> "E"%1
"F"
*Main> "E"%4
"G#"
*Main> "Dsus7"%3
"Fsus7"
*Main> "C/G"%5
"F/C"
*Main> "F#sus7/A#"%1
"Gsus7/B"

OK, within the limitations of the question as asked and not catering for a lot of things you'd need to allow for if using with real music (flats being the most obvious):
function t(c,a) {
  var s=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],i;
  return c.replace(/[A-G]#?/g,function(m){return s[(i=(s.indexOf(m)+a)%s.length)<0?i+s.length:i];});
}

This is my first attempt at code-golf, so I hope I've taken the right approach. Following is the readable version that I originally posted at stackoverflow.com:
function transposeChord(chord, amount) {
  var scale = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"];
  return chord.replace(/[CDEFGAB]#?/g,
                       function(match) {
                         var i = (scale.indexOf(match) + amount) % scale.length;
                         return scale[ i < 0 ? i + scale.length : i ];
                       });
}

I think flats and stuff like E# etc isn't really useful when simply "sharing" chords with friends and playing music this way. Of course they are very important in sheet music etc, but for people transposing music to play for their own pleasure, this seems like a very satisfying solution. +1

@RIMMER - Even with a simple chord chart I find it much harder to follow when the author has ignored flats. Do you never play in the key of F (which has a Bb, not an A#)? I'd like to see a full solution (using my function or not) that transposes a whole chord chart and not just one chord. Thanks for the up-vote.

Oh OK, I see what you mean now. Well, I play the piano and I know the scales perfectly, so even if the chords say A# and I'm in the F scale, I always know that I can play A in that scale and that the A# notation is actually Bb. Anyway, maybe you can re-define the problem to consider all this in the equation? I don't know how to explain the whole theory to reach the full solution, but I'd be happy to see the code!

A full solution is beyond me (and would probably be incomprehensible in a code-golf setting). I agree that yes, if I see an A# chord in the key of F I know that it should be a Bb, but it's a distraction so I'd rather correct the chart before I play from it.

If I write down all the chords and exactly specify which scale has what sharps and what flats and would offer you a money reward, how much would it cost to code the full solution? (this is rather a reply for your stackoverflow comment, but I didn't want to put it there). anyway, my mail is rimmer@rimmer.sk ...

I'm not sure how long it would take to write a solution that would satisfy me, certainly much longer than it would take me to just transpose manually whenever I happen to need it. I'd suggest extending the above function to accept another parameter for whether to use sharps or flats for the output key, and to look for sharps and flats in the input, and you'd probably be most of the way there for most normal cases - probably wouldn't take too long to get that far. Then just manually double-check the output for edge cases.

P.S. Google found a few websites that offer transposition on a par with what I coded above, some of which also show guitar chord fingerboard diagrams for the appropriate key, e.g.: http://www.transposechords.com/ and http://www.chordie.com.

I've got 186 as the count for this solution, please let me know if I got it wrong.

As a preliminary effort, I'd like to flesh-out some of what "the full solution" should take into account.
Sharps and Flats
When transposing a musical key, one adds sharps or flats to the key signature according to the distance traversed in the "circle of fourths" (or fifths, depending on the direction you're going).
fifths from C up to the enharmonic
key: C G  D  A  E  B  F# C# G#  D#  A#  E#  B#
add:   F# C# G# D# A# E# B# F## C## G## D## A##

fourths from C down to the enharmonic
key: C F  Bb Eb Ab Db Gb Cb Fb  Bbb Ebb Abb Dbb
add:   Bb Eb Ab Db Gb Cb Fb Bbb Ebb Abb Dbb Gbb

So the key of C can be written with zero sharps or flats, or with twelve sharps, or with twelve flats. The first options is clearly superior.
But we only really need the middle of the table above because all those double-sharps and double-flats mean that some note is being given an overly-complicated name. So extracting the middle and arranging in sequence gives us this list of keys.
C  Db(5 'b's) D(2#) Eb(3b) E(4#) F(1b) F#(6#)[or Gb(6b)]
G(1#) Ab(4b) A(3#) Bb(2b) B(5#) C

And, dropping the counts and picking between F# and Gb (all flats looks prettier than one lonely sharp) gives:
C Db D Eb F Gb G Ab A Bb B C

But for named chords, the situation is less clear because the names carry accidentals with them.

Javascript, 249
This code handles bemol input:
let N=["A","A#","B","C","C#","D","D#","E","F","F#","G","G#"]
let t=(r,n)=>r.split("/").map((i)=>{
let a=i[1]
let m=a=="#"||a=="b"?2:1
let c=i.slice(0,m)
c=a=="b"?t(c[0],-1):c
let x=(N.indexOf(c)+n)%12
x=x<0?12+x:x
return N[x]+i.slice(m)
}).join("/")

Limitations:

No double flat or double sharp support.
No validation of the chord's bass note or modifiers.
Output always uses sharps for accidents. i.e: G#/C instead of Ab/C.

To solve the 'full' problem, you need the program to understand the chord modifiers and calculate each note that the chord uses, then match that with the transposed chord to get the right answer. While possible I see it unpractical to code that in a code golf setting.
'Readable' version:
let Notes=["A","A#","B","C","C#","D","D#","E","F","F#","G","G#"]
let transpose=(input,n)=>input.split("/").map((splittedInput)=>{
let accident=splittedInput[1]
let modifierIndex=accident=="#"||accident=="b"?2:1
let note=splittedInput.slice(0,modifierIndex)
note=accident=="b"?transpose(note[0],-1):note
let transposedIndex=(Notes.indexOf(note)+n)%12
transposedIndex=transposedIndex<0?12+transposedIndex:transposedIndex
return Notes[transposedIndex]+splittedInput.slice(modifierIndex)
}).join("/")

Welcome to the site! Answers should include code in the body of the question (rather than an external link), and the code should aim to be competitive (i.e. golfed as this is a code-golf challenge).

Thanks for letting me know. I wasn't familiar with the code golf concept.

all_licenses: 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/


text:
Write a function to decrypt Feynman Challenge Cipher #1
The Feynman Challenge Cipher #1 is as follows:
MEOTAIHSIBRTEWDGLGKNLANEAINOEEPEYST
NPEUOOEHRONLTIROSDHEOTNPHGAAETOHSZO
TTENTKEPADLYPHEODOWCFORRRNLCUEEEEOP
GMRLHNNDFTOENEALKEHHEATTHNMESCNSHIR
AETDAHLHEMTETRFSWEDOEOENEGFHETAEDGH
RLNNGOAAEOCMTURRSLTDIDOREHNHEHNAYVT
IERHEENECTRNVIOUOEHOTRNWSAYIFSNSHOE
MRTRREUAUUHOHOOHCDCHTEEISEVRLSKLIHI
IAPCHRHSIHPSNWTOIISISHHNWEMTIEYAFEL
NRENLEERYIPHBEROTEVPHNTYATIERTIHEEA
WTWVHTASETHHSDNGEIEAYNHHHNNHTW

The solution is described as:

It is a simple transposition cipher: split the text into
  5-column pieces, then read from lower right upward.  What results are the
  opening lines of Chaucer's Canterbury Tales in Middle English.

Which is:
WHANTHATAPRILLEWITHHISSHOURESSOOTET
HEDROGHTEOFMARCHHATHPERCEDTOTHEROOT
EANDBATHEDEVERYVEYNEINSWICHLICOUROF
WHICHVERTUENGENDREDISTHEFLOURWHANZE
PHIRUSEEKWITHHISSWEETEBREFTHINSPIRE
DHATHINEVERYHOLTANDHEETHTHETENDRECR
OPPESANDTHEYONGESONNEHATHINTHERAMHI
SHALVECOURSYRONNEANDSMALEFOWELESMAK
ENMELODYETHATSLEPENALTHENYGHTWITHOP
ENYESOPRIKETHHEMNATUREINHIRCORAGEST
HANNELONGENFOLKTOGOONONPILGRIM

The Challenge:
Write a function to decrypt the cipher.
The output does not need line breaks or spaces.
Input is has no line breaks or spaces.
Shortest solution wins.
(Bonus points if you can solve the other 2 ciphers :P)

My attempt (PHP 77 70):
$b=strrev($a);for($i=0;$i<5;$i++)for($j=0;$j<381;$j++)$r.=$b[$i+$j*5];

http://codepad.org/PFj9tGb1

What restrictions are there on input assumptions? E.g. both solutions so far assume input as a single line with no whitespace; yours assumes that it's in a variable and gnibbler's assumes that it's on stdin.

Golfscript, 10 chars
n--1%5/zip

Takes input from stdin. It may be separated by newlines, as in the question presentation, or not, as many answers assume. (Stripping the newlines is necessary anyway given that it's likely to arrive with one on the end, which messes up the blocks of 5). If we assume that the input arrives with precisely one newline, being the last character, we can shave one character to
)!(%5/zip

Mathematica, 51

Mathematica is quite verbose here, but it is also easy to guess what it's doing.
Thread[Characters@#~Partition~5]~Reverse~{1,2}<>""&

J, 13 characters
|.@(/:5|i.@#)

Haskell, 52
f s=[s!!(x-i)|x<-[length s],j<-[1..5],i<-[j,j+5..x]]

x<-[length s]... disgusting. I love it!

Japt -P, 4 3 bytes
Ôó5

Try it online!
I feel like that was too easy? On a positive note, this can't possibly be golfed too much assuming I am getting the correct result :)
EDIT -1 byte thanks to @Shaggy!
Ôó5    # full program
Ô      # reverse input string
 ó5    # create a 5-element array by repeatedly
       # picking every 5th character.
       # -P flag concatenates array on output!

There's a shortcut for w  ;)

Python - 56 chars
s=raw_input()
print"".join(s[-1-x::-5]for x in range(5))

2 characters shorter with python 3 (-4 for input instead of raw_input; +2 for adding parenthesis to print.

Scala, 62 characters
print((for(x<-0 to 4;y<-379-x to 0 by -5)yield s(y)).mkString)

Making the assumption that the string is already in a variable s as hammar and stevether do.
Taking the input from stdin is a bit uglier (92 chars):
var s=io.Source.stdin.mkString
print((for(x<-0 to 4;y<-379-x to 0 by -5)yield s(y)).mkString)

and it only works if there are no newlines in the input.

Perl, 58 characters
perl -lne'$c[$c++%5].=$_ for split//}END{$"=$,,print$_=reverse"@c"'

Scala 63 chars:
(1 to 5).map(n=>s.reverse.drop(n)).map(_.sliding(1,5).mkString)

Assuming the input is in s.

K, 34
{a::(5*!76)_x;1'{a[;x]@|!#a}@'|!5}

ECMAScript 6 - 48 Characters
for(c='',i=5;i--;)c+=(x=>s[x]?f(x+5)+s[x]:'')(i)

Assumes that the variable s contains the input string (without any white space characters) and creates the variable c containing the output.

Python 3.6, 48 bytes
Recursion + f-Strings
f=lambda a:a and f'{a[::-5]+f(a[:-1])}'[:len(a)]

Try it online!


text:
Playing the Name Game
Write a program to play the name game.
Input
Your program should accept a single name as input from the user in some way (e.g read from standard input or as a command-line argument). You can assume that the name is a single word consisting of an upper case letter followed by one or more lower case letters.
Output
Your program must print the rhyme for the given name, as explained in the song, by filling out the following template:
(X), (X), bo-b(Y)
Banana-fana fo-f(Y)
Fee-fi-mo-m(Y)
(X)!

Here, (X) is the original name, and (Y) is the name in lower case with any initial consonants removed.
There is one exception, however. If the original name began with m, f or b, it should be written without this letter on the corresponding line. E.g. if the name was Bob, the "b" line should end with bo-ob. Note that in this case, any other consonants are kept, so for Fred it's fo-red, not fo-ed.
Examples
Shirley:
Shirley, Shirley, bo-birley
Banana-fana fo-firley
Fee-fi-mo-mirley
Shirley!

Arnold:
Arnold, Arnold, bo-barnold
Banana-fana fo-farnold
Fee-fi-mo-marnold
Arnold!

Bob:
Bob, Bob, bo-ob
Banana-fana fo-fob
Fee-fi-mo-mob
Bob!

Fred:
Fred, Fred, bo-bed
Banana-fana fo-red
Fee-fi-mo-med
Fred!

Scoring
Shortest code wins.

I guess Y is handled as a vocal, so Yves is like Ives or Arnold.

But what about Yates, Yestin, Yolanda, or Yulia?

@ephemient: I guess you could treat Y as a vowel only if it's followed by a consonant. That should cover those cases at least.

I feel sorry for Tucker.

vi, 118 115
Y2PA,<ESC>Ypj~Y2PIbo-b<c-o>wBanana-fana fo-f<c-o>wFee-fi-mo-m<c-o>2$!<ESC>HJJ:%s/\vo-(([bfm])\2([^aeiou]*))?([bfm]?)[^aeiou]*/o-\3\4
ZZ

The code includes 5 control characters, which I've put in brackets. Each only counts as a single character towards the character count.
EDIT: Moving the first join (J) to later and changing the paste-before (P) to a paste-after (p) saved me 1 character. Also, not capturing the o- in the regex saved me 2 more characters.

SNOBOL4, 437 430 bytes
 N = TRIM(INPUT)
 D = REPLACE(N,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
+'abcdefghijklmnopqrstuvwxyz')
 B = "b" D
 F = "f" D
 M = "m" D
 &ANCHOR = 1
 D SPAN('bcdfghjklmnpqrstvwxyz') . I REM . R :F(Y)
 B = "b" R
 F = "f" R
 M = "m" R
 I "b" :S(U)
 I "f" :S(V)
 I "m" :S(W) F(Y)
U D "b" REM . B :(Y)
V D "f" REM . F :(Y)
W D "m" REM . M
Y OUTPUT = N ", " N ", bo-" B
 OUTPUT = "Banana-fana fo-" F
 OUTPUT = "Fee-fi-mo-" M
 OUTPUT = N "!"
END

Ungolfed (plus I added a prompt; the one above just waits for a name to be typed):
      OUTPUT = "Please enter your name."
      Name = TRIM(INPUT)
      UC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
      LC = 'abcdefghijklmnopqrstuvwxyz'
      Low = REPLACE(Name, UC, LC)
      BName = "b" Low
      FName = "f" Low
      MName = "m" Low
      Consonants = SPAN('bcdfghjklmnpqrstvwxyz')
      &ANCHOR = 1
      Low Consonants . First REM . Rest  :F(READY)
      BName = "b" Rest
      FName = "f" Rest
      MName = "m" Rest
      First "b"                   :S(BINIT)
      First "f"                   :S(FINIT)
      First "m"                   :S(MINIT) F(READY)
BINIT Low "b" REM . BName         :(READY)
FINIT Low "f" REM . FName         :(READY)
MINIT Low "m" REM . MName
READY OUTPUT = Name ", " Name ", bo-" BName
      OUTPUT = "Banana-fana fo-" FName
      OUTPUT = "Fee-fi-mo-" MName
      OUTPUT = Name "!"
END

This is the first SNOBOL program I've ever written.
SNOBOL is a line-oriented language, like FORTRAN, COBOL, or BASIC. Each line consists of an optional label starting in column 1, the code for the line which can involve assignments and pattern matching, and an optional branch. Yes, lines end with (optional) GOTOs. They come in two forms:
        :(TARGET)

Branches to label TARGET, while
        :S(SUCCESS) F(FAILURE)

Branches to SUCCESS if the pattern match succeeded, or FAILURE otherwise. You can also just branch on success and fall through to the next line on failure, or vice versa.
Continuation lines begin with a + or .. Comments begin with a *.
How does it work?
Read in a name, convert it to lower case. Set up the B-, F-, and M-names assuming it begins with a vowel. Then check if it begins with a span of consonants. If not, we're ready to go! If so, strip the leading consonants and set up the B-, F-, and M-names assuming it doesn't begin with any of those letters. Finally, check if it starts with each of those letters in turn, fixing up the names as needed. Then we're ready to play the name game!
Sample run:
 # $RUN *SNOBOL4 5=GOLF.SNO+*SOURCE* 6=*DUMMY*(1,28)+*SINK*(1,4)+*DUMMY*
 # Execution begins   16:57:25
   Snowman
   Snowman, Snowman, bo-bowman
   Banana-fana fo-fowman
   Fee-fi-mo-mowman
   Snowman!
 # Execution terminated   16:57:30  T=0.013

I ran this on the Hercules S/370 mainframe emulator running the 6.0a release of the Michigan Terminal System using SNOBOL4 version 3.10 from April 1, 1973 built for MTS on May 1, 1975, but there are probably easier ways to run SNOBOL4 on a modern system. :)
Edit: Removed a redundant success branch that was equivalent to a fallthrough (I didn't realize I could put just a failure branch by itself) which eliminates an unneeded branch label, and turned an unconditional goto into a failure branch on the prior line, for a savings of 7 bytes.
Now that TIO has SNOBOL4 support you can
Try it online! Note: It shows the size as 429 rather than 430 because when I pasted it there, the final linefeed got removed. I tried changing the continuation line (the one beginning with +) to a single line, which wasn't legal on the mainframe version because the line was too long, and it worked and brought it down to 427. Obviously CSNOBOL4 allows longer lines. I'm going to leave my score at 430, though, because that's how many bytes the script was on my machine, and besides, SNOBOL is pretty non-competitive.

You can now run SNOBOL4 on Try it online

@Giuseppe Wow, that's cool! Thanks for letting me know.

CSNOBOL4 has a couple other differences, as assignment only requires the leading space, so all your lines like N = TRIM(INPUT) can be N =TRIM(INPUT).

J, 149 characters
1!:2&2>|.(n,'!');('Fee-fi-mo-';'Banana-fana fo-';n,', ',n,', bo-'),&.>;/'mfb'(,`(}.@])`($:}.)@.((=+.2*5='aeiou'i.]){.)"0 _)a.{~32(23 b.)a.i.n=.1!:1]3

Javascript, 115 Bytes
r=x=>x.match(/[aeiou]\w*/i)[0];f=x=>`${x}, ${x}, bo-b${r(x)}\nBanana-fana fo-f${r(x)}\nFee-fi-mo-m${r(x)}\n${x}!`

Explanation:
this function returns the name without the initial consonants
r=x=>x.match(/[aeiouAEIOU]\w*/)[0]

Then the rest is a function returning the string complete string.
f=x=>`${x}, ${x}, bo-b${r(x)}\nBanana-fana fo-f${r(x)}\nFee-fi-mo-m${r(x)}\n${x}!`

Edit: from 119 to 115 bytes thanks to @Martin Ender

Welcome to PPCG! I believe you can shorten that regex to /[aeiou]\w*/i.

You can replace the original version with the shortened one. The old one will be preserved in the edit history of the post. If you want to you can include previous scores like JavaScript, <s>119</s> 115 bytes in the header to give people a hint that there was originally a longer version if they are interested.

Ah, cool. Editted again :)

Clojure, 292 characters after minimizing
Here's a first attempt, almost positive I can widdle it down further:
(defn name-game
  [n]
  (let [[b f m] (map (fn [x] (if (some #(= % (first n) (last x)) "bfm")
                              (str (apply str (butlast x)) (apply str (rest n)))
                              (str x (apply str (drop-while (fn [x] (not (some #(= % x) "aeiou"))) n))))) [", bo-b" "\nBanana-fana-fo-f" "\nFee-fi-mo-m"])]
    (str n ", " n b f m "\n" n "!")))

I'm just learning clojure and thought it'd be fun to give this a shot. Here's my reasoning:

 - To strip off consonants from beginning of string: (drop-while (fn [x] (not (some #(= % x) "aeiou"))) name)

 -  To handle the extra rules for "b", "f" and "m", I broke text into list of phrases: [", bo-b" "\nBanana-fana-fo-f" "\nFee-fi-mo-m"]

 - Then, I applied a function that asks whether the phrase ends with the same letter that the name starts with, and used that to transform
 those 3 phrases based on the rules of the puzzle

 - Final step is to build a string with results

Scala 281
I replaced (X) and (Y) in the pattern with # and 012. S is just a new name for String and a(b,c,d) is shorthand definition for b.replaceAll(c,d)
val v="""#, #, bo-b0
Banana-fana fo-f1
Fee-fi-mo-m2
#!"""
type S=String
def a(b:S,c:S,d:S)=b.replaceAll(c,d)
def r(t:S,n:S,i:Int)=if(n(0)=="bfm"(i).toUpper)a(t,"."+i,n.tail)else
a(t,""+i,a(n,"^[^AEIOUaeiou]*([aeiou].*)","$1")).toLowerCase
def x(n:S)=a(r(r(r(v,n,0),n,1),n,2),"#",n)

Test invocation:
val l = List ("Shirley", "Arnold", "Bob", "Fred")
for (n <- l) println (x (n) + "\n")

And ungolfed:
val templ = """#, #, bo-b0
Banana-fana fo-f1
Fee-fi-mo-m2
#!"""

val names = List ("Shirley", "Arnold", "Bob", "Fred")
val keys = "bfm"

def recode (template: String, n: String, i: Int) =
 if (n(0) == keys(i).toUpper)
   template.replaceFirst ("." + i, n.tail) else
 template.replaceAll ("" + i, (n.replaceAll ("^[^AEIOUYaeiouy]*([aeiou].*)", "$1").toLowerCase))

for (name <- names)
  println (recode (recode (recode (templ, name, 0), name, 1), name, 2).replaceAll ("#", name) + "\n")

Python 3, 148 145 142 bytes
Yes I know it's a little late but...
n=input();i=0
r=n[i:].lower()
while n[i]not in'aeiouAEIOU':i+=1;r=n[i:]
print(f'{n}, {n}, bo-b{r}\nBanana-fana fo-f{r}\nFee-fi-mo-m{r}\n{n}!')

It uses the new f-strings to format the resulting string.
I don't think TIO supports f-strings yet, unfortunately.
Old Version
def f(n,i=0):
 r=n[i:].lower()
 while n[i].lower()not in'aeiou':i+=1;r=n[i:]
 return f'{n}, {n}, bo-b{r}\nBanana-fana fo-f{r}\nFee-fi-mo-m{r}\n{n}!'

Saved 3 bytes thanks to @officialaimm

save three bytes by using 'AEIOUaeiou' literal and avoiding lower() in 3rd line

Sed, 162 bytes
sed 'h;G;G;G' |sed '1s/.*/&, &, bo-b\L&/i;2s/^.*/Banana-fana fo-f\L&/;3s/^.*/Fee-fi-mo-m\L&/;4s/$/!/;tx;:x;s/o-\([bfm]\)\1/o-/i;tz;s/\(o-[bfm]\)[^aeiou]\+/\1/;:z'

I did not know sed very well before I did this. I, uh, know it a lot better, now. The first sed in the pipeline duplicates the name three times so it becomes "Bob\nBob\nBob\nBob" instead of just "Bob". The next sed does the heavy lifting.
Expects input on stdin like echo Name |sed ...
Ungolfed:
sed 'h                           ;# copy to hold buffer
G                                ;# append newline + hold buffer to pattern
G                                ;# ditto for next two G's
G' |sed '1s/.*/&, &, bo-b\L&/i   ;# 1st line -> X, X bo-bx (lowercase)
2s/^.*/Banana-fana fo-f\L&/      ;# 2nd line -> Banana-fana fo-fx
3s/^.*/Fee-fi-mo-m\L&/           ;# 3rd line -> Fee-fi-mo-mx
4s/$/!/                          ;# bang the 4th line!
tx                               ;# jump to :x if any s/// has matched
:x                               ;# spoiler alert: it has! reset t-flag
s/o-\([bfm]\)\1/o-/i             ;# match some o-cc where c = [bfm]
tz                               ;# if that matched, branch to :z
s/\(o-[bfm]\)[^aeiou]\+/\1/      ;# replace o-[bfm] plus consonants with o-[bfm]
:z                               ;# target of tz, skips over previous s///'

A couple of notes. The first four matches, 1s, 2s, 3s, 4s, transform the output into something not quite correct. Bob has become bo-bbob, Fred has become fo-ffred, and Mike has become mo-mmike. Kay would become mo-mkay, mkay?
Then, we need to replace either bo-bbob with bo-ob, or bo-bkay with bo-bay. To do that, we can use a feature where we do one s/// substitution, and then branch if it succeeded, jumping over the second one that we now want to skip. But if it missed, we want to fall through the branch and do the next substitution.
The t[label] command does that, branching only if a previous s/// matched. But at the beginning of the script I already did one s/// for each line (the leading numbers in 1s, 2s, etc. are addresses; they mean the command is only performed if the address matches). So no matter what line we're on, 1, 2, 3, or 4, at least one s/// has matched. (I tried doing it the other way around, massaging the names and then adding the "Banana-etc." after, but got stuck that way, and trying to do it all at once would cause some repetition.) Fortunately, the flag can be cleared by taking a branch, so we do that with "tx ; :x". tx branches to the x label, and :x is the x label.
Whew! That clears the palate for the final two substitutions. We try one, and if it succeeds we branch over the other, otherwise we do the second one. Either way we end up at the :z label and the pattern buffer contains one line of lyrics which is printed to stdout.
Thanks for tricking me into spending enough time with the sed man page and Texinfo manual to finally understand how do to more than sed s/foo/bar/

Oh, I'm counting the whole length of the script with the sed command and the | and all. Maybe I should call this bash / sed, or count it differently? I don't know. I'm happy with it as-is but let me know if it should be different by the standards of PPCG.

Go, 193 186 173 bytes
import(."fmt";."regexp")
func f(s string){y:=MustCompile(`^[^AEIOUaeiou]+`).ReplaceAllString(s,"")
Printf(`%s, %s, bo-b%s
Banana-fana fo-f%s
Fee-fi-mo-m%s
%s!`,s,s,y,y,y,s)}

Attempt This Online!
Prints to STDOUT.

-7 bytes by not using explicit indexes
-13 bytes by @The Thonnu by not using the strings package

Your current version doesn't actually work (mismatched parentheses), but here's a fix for 173 bytes

Python, 161
x=raw_input('')
a,b,c=x[0],x[1:],'bfm'
if b[0] in c:b=b[1:]
d="X, X, bo-@\nBanana-fana fo-@\nFee-fi-mo-@\nX!".replace('X',a)
for y in c:d=d.replace('@',y+b,1)
print d

Just realised my code fails...
- Doesn't remove initial constonants.
- Doesn't manage the 'bo-ob' business.
It's the furthest I got, maybe somebody can finish it.

Groovy, 146
r={n->m={n[0]==it[0]?n[1..-1]:it[1]+(n.toLowerCase()=~'[aeiou].*')[0]};"$n, $n, bo-${m 'Bb'}\nBanana-fana fo-${m 'Ff'}\nFee-fi-mo-${m 'Mm'}\n$n!"}

assert ['Shirley', 'Arnold', 'Bob', 'Fred'].collect { r(it) } == [
'''Shirley, Shirley, bo-birley
Banana-fana fo-firley
Fee-fi-mo-mirley
Shirley!''',
'''Arnold, Arnold, bo-barnold
Banana-fana fo-farnold
Fee-fi-mo-marnold
Arnold!''',
'''Bob, Bob, bo-ob
Banana-fana fo-fob
Fee-fi-mo-mob
Bob!''',
'''Fred, Fred, bo-bed
Banana-fana fo-red
Fee-fi-mo-med
Fred!'''
]

R, 189 chars
x=scan(,'');f=function(b)if(grepl(b,x))sub('.','',x)else tolower(sub('^[^aoueiy]*',b,x,i=T));cat(sprintf('%s, %1$s, bo-%s\nBanana-fana fo-%s\nFee-fi-mo-%s\n%1$s!\n',x,f('B'),f('F'),f('M')))

But with just one more character, you can entry many names in one go:
x=scan(,'');f=function(b)ifelse(grepl(b,x),sub('.','',x),tolower(sub('^[^aoueiy]*',b,x,i=T)));cat(sprintf('%s, %1$s, bo-%s\nBanana-fana fo-%s\nFee-fi-mo-%s\n%1$s!\n',x,f('B'),f('F'),f('M')))

Pyth, 111 bytesSBCS
V"BFM"IqhzN=aYtrz0.?=aY+rN0:rz0"^[^aeiou]+"k))+%." sÞXY:lÍ"*]z2@Y0+." o1}1ÃÐ¬ÛJî½"@Y1+."-o Âkq°ë¹è"@Y2+z\!

Test suite
Code uses unprintable characters, and as such does not display properly on Stack Exchange. The link provided contains these characters and is the correct version of the program.

Perl 5 -na, 93 bytes
s/^[FMB]//||s/^[^aeiou]*//i;$,=$_.$/;say"@F, @F, bo-b","Banana-fana fo-f","Fee-fi-mo-m","@F!"

Try it online!

Japt, 55 54 bytes
+Si,)²+`¾-b
Ba-fa fo-f
Fee-fi-¶-m
{U}!`rRRiUv e"^%c

Try it
+Si,)²+`¾...{U}!`rRRiUv e"^%c     :Implicit input of string U
+                                 :Append
 S                                :  Space
  i,                              :  Prepend ","
    )                             :End append
     ²                            :Duplicate
      +                           :Append
       `¾...   !`                 :Compressed string "bo-b\nBanana-fana fo-f\nFee-fi-mo-m\n...!"
            {U}                   :Interpolate U
                 r                :Replace
                  R               :  Newline with
                   Ri             :    Prepend newline with
                     Uv           :      U lowercased
                        e"^%c     :      Recursively replace RegEx /^[^aeiou]/i

JavaScript, 100 bytes
s=>s+`, ${s}, bo-b${t=/[aeiou].+/.exec(s.toLowerCase())}
Banana-fana fo-f${t}
Fee-fi-mo-m${t}
${s}!`

Try it online!

Haskell, 151 bytes
z x|let y=last$(snd$break(`elem`"AEIOUaeiou")x):[tail x|elem(x!!0)"BFM"]=unlines[x++", "++x++", bo-b"++y,"Banana-fana fo-f"++y,"Fee-fi-mo-m"++y,x++"!"]

Try it online!
Haskell, 152 bytes
z x|let y=last$dropWhile(`notElem`"AEIOUaeiou")x:[tail x|elem(x!!0)"BFM"]=unlines[x++", "++x++", bo-b"++y,"Banana-fana fo-f"++y,"Fee-fi-mo-m"++y,x++"!"]

Try it online!

Python
n=raw_input('')
if n[0].lower() in ("m", "f", "b"): r=n[1:]
else:
    i = iter(n.lower())
    for a in range(len(n)):
        if i.next() in ("a","e","i","o","u"):
            r = n[a:]
            break
print "%s, %s, bo-b%s\nBanana-fana fo-f%s\nFee-fi-mo-m%s\n%s!" %(name,name,rhyme,rhyme,rhyme,name)