The following seems to be a problem with simplify_sum:
Maxima 5.41.0 http://maxima.sourceforge.net using Lisp SBCL 1.4.2-1.fc27 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) load(simplify_sum); (%o1) /usr/share/maxima/5.41.0/share/solve_rec/simplify_sum.mac (%i2) display2d:false; (%o2) false (%i3) simplify_sum(sum(factorial(l-1)*binomial(n,l), l, 3, n)); (%o3) %k[3]*n^2-%k[3]*n
It looks like the %k[3] constant is something that escapes from the linear recurrence solver or so.
Found in sage:
The leaking
%k[3]
comes from the solve_rec function. After looking at it for a few minutes, my first guess is that simplify_sum has supplied only 2 initial conditions to solve_rec, but 3 are needed by solve_rec_ic1 in order to eliminate all three arbitrary constants which are introduced by hyper_poly (called from solve_rec).So there is some interaction between solve_rec and simplify_sum, but at this point I think the problem is in simplify_sum.