login
Sum_{0<j<k<=n} (k!-j!).
10

%I #21 Oct 11 2015 02:55:02

%S 1,10,73,520,3967,33334,309661,3166468,35416555,430546642,5655609529,

%T 79856902816,1206424711303,19419937594990,331860183278677,

%U 6000534640290364,114462875817046051,2297294297649673738,48394006967070653425

%N Sum_{0<j<k<=n} (k!-j!).

%C In the following guide to related sequences,

%C c(n) = Sum_{0<j<n} s(n)-s(j),

%C t(n) = Sum_{0<j<k<=n} s(k)-s(j).

%C s(k).................c(n)........t(n)

%C k....................A000217.....A000292

%C k^2..................A016061.....A004320

%C k^3..................A206808.....A206809

%C k^4..................A206810.....A206811

%C k!...................A206816.....A206817

%C prime(k).............A152535.....A062020

%C prime(k+1)...........A185382.....A206803

%C 2^(k-1)..............A000337.....A045618

%C k(k+1)/2.............A007290.....A034827

%C k-th quarter-square..A049774.....A206806

%H Danny Rorabaugh, <a href="/A206817/b206817.txt">Table of n, a(n) for n = 2..400</a>

%F a(n) = a(n-1)+(n-1)s(n)-p(n-1), where s(n) = n! and p(k) = 1!+2!+...+k!.

%F a(n) = Sum_{k=2..n} A206816(k).

%e a(3) = (2-1) + (6-1) + (6-2) = 10.

%t s[k_] := k!; t[1] = 0;

%t p[n_] := Sum[s[k], {k, 1, n}];

%t c[n_] := n*s[n] - p[n];

%t t[n_] := t[n - 1] + (n - 1) s[n] - p[n - 1];

%t Table[c[n], {n, 2, 32}] (* A206816 *)

%t Flatten[Table[t[n], {n, 2, 20}]] (* A206817 *)

%o (Sage) [sum([sum([factorial(k)-factorial(j) for j in range(1,k)]) for k in range(2,n+1)]) for n in range(2,21)] # _Danny Rorabaugh_, Apr 18 2015

%o (PARI) a(n)=sum(j=1,n,j!*(2*j-n-1)) \\ _Charles R Greathouse IV_, Oct 11 2015

%o (PARI) a(n)=my(t=1); sum(j=1,n,t*=j; t*(2*j-n-1)) \\ _Charles R Greathouse IV_, Oct 11 2015

%Y Cf. A000142, A206816.

%K nonn

%O 2,2

%A _Clark Kimberling_, Feb 12 2012