On Wednesday, October 4, 2017 at 6:14:18 AM UTC-4, Peter Luschny wrote:
restart;
a := n -> n!*(1+hypergeom([-n+1],[-n],-1))-(n!-GAMMA(n+1,-1)/exp(1)): simplify(expand(a(n)));
seq(simplify(expand(a(n))),n=1..9);
1, 2, 5, 20, 97, 574, 3973, 31520, 281825
# OK, so let's take the simplification proposed by Maple!
a1 := n -> exp(-1)*(GAMMA(n+2)+GAMMA(n+1, -1)*n)/n; seq(simplify(expand(a1(n))),n=1..9);
2*exp(-1), 3*exp(-1)+1, 8*exp(-1)+2, 30*exp(-1)+9, 144*exp(-1)+44, 840*exp(-1)+265, 5760*exp(-1)+1854, 45360*exp(-1)+14833, 403200*exp(-1)+133496
The simplification of that hypergeom expression seems to blame. But one could work around it by simplifying under the assumption that n is of type `posint`.
restart;
b:=hypergeom([-n+1],[-n],-1);
b := hypergeom([-n + 1], [-n], -1)
s:=simplify(b); # hrmm
exp(-1) (n + 1)
s := ---------------
n
q:=simplify(b) assuming n::posint;
GAMMA(2 + n, -1) exp(-1)
q := ------------------------
n GAMMA(n + 1)
[seq(b, n=1..5)];
[1, hypergeom([-1], [-2], -1), hypergeom([-2], [-3], -1),
hypergeom([-3], [-4], -1), hypergeom([-4], [-5], -1)]
simplify(%);
11 53
[1, 1/2, 1/2, --, ---]
24 120
[seq(s, n=1..5)]; # sigh
[2 exp(-1), 3/2 exp(-1), 4/3 exp(-1), 5/4 exp(-1), 6/5 exp(-1)]
[seq(q, n=1..5)];
[exp(-1) exp(1), 1/2 exp(-1) exp(1), 1/2 exp(-1) exp(1),
11 53
-- exp(-1) exp(1), --- exp(-1) exp(1)]
24 120
simplify(%);
11 53
[1, 1/2, 1/2, --, ---]
24 120
One way to do your original could then be, say,
restart;
a := n -> n!*(1+hypergeom([-n+1],[-n],-1))-(n!-GAMMA(n+1,-1)/exp(1)):
seq(simplify(expand(a(n))),n=1..9);
1, 2, 5, 20, 97, 574, 3973, 31520, 281825
a1 := unapply(evalindets(a(n),specfunc(anything,hypergeom),
simplify),n) assuming n::posint;
/ GAMMA(n + 2, -1) exp(-1)\ GAMMA(n + 1, -1)
a1 := n -> n! |1 + ------------------------| - n! + ----------------
\ n GAMMA(n + 1) / exp(1)
seq(simplify(expand(a1(n))),n=1..9);
1, 2, 5, 20, 97, 574, 3973, 31520, 281825
I will submit a bug report.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)