When I run this snippet in MMA
Map[Fold[Plus[#, ##] &, {0}, Range[#]] &, Range[8]]
(* {{1}, {4}, {11}, {26}, {57}, {120}, {247}, {502}} *)
(* or *)
Map[Fold[Plus[##, #] &, {0}, Range[#]] &, Range[8]]
These are: from OEIS: A000295 Eulerian numbers (Euler's triangle: column k=2 of A008292, column k=1 of A173018).
Obviously, the function calls, of #1 & ## (all the rest) &; must be duplicating a pattern of:
Table[2^n - n - 1, {n, 20}]
Mr. Weisstein on the same OEIS page.
Why is this? Is it fundamental to MMA & it's pure functions approach?
Map[Fold[Plus[#1, #1, #2] &, {0}, Range[#]] &, Range[8]]
? $\endgroup$Map[Fold[Plus[#1,#1,#2+1]&,{0},Range[#]]&,Range[5]]
this makes A095151. Another triangle sequence, part of Bells Triangle. I think, I get it. It is just all about repetition/recursion? $\endgroup$Map[Fold[Plus[#1, #2, #2] &, {0}, Range[#]] &, Range[10]]
(1) A002378 Oblong (or promic, pronic, or heteromecic) numbers: a(n) = n*(n+1), (2) Denominators in Harmonic Triangle. (3) A103505 Denominator in expansion of(1-x)*Log[1-x]
. $\endgroup$f[x_] := (1 - x)*Log[1 - x]; Series[g[x], {x, 0, 10}]
produces: {2, 6, 12, 20, 30, 42, .. } as denominators. Interesting. $\endgroup${0}
, so:Map[Fold[Plus[#1, #1, #2] &, Range[#]] &, Range[8]]
. Your last one can also be done asMap[Fold[Plus[#2, ##] &, 0, Range[#]] &, Range[10]]
. In any case, please look up#
and##
in the docs. $\endgroup$