Skip to main content
added 3 characters in body
Source Link
Mr.Wizard
  • 2.6k
  • 18
  • 17

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 

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 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 

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 
added 454 characters in body
Source Link
Mr.Wizard
  • 2.6k
  • 18
  • 17

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 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 

Mathematica: 36


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

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 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 
deleted 1 characters in body
Source Link
Mr.Wizard
  • 2.6k
  • 18
  • 17

Mathematica: 3736


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

Mathematica: 37


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

Mathematica: 36


Mathematica has the `Binomial` function, but that takes the fun out of this. I propose:
NestList[{0,##}+{##,0}&@@#&,{1},n-1] 
added 26 characters in body
Source Link
Mr.Wizard
  • 2.6k
  • 18
  • 17
Loading
Source Link
Mr.Wizard
  • 2.6k
  • 18
  • 17
Loading