A227363 a(n) = n + (n-1)*(n-2) + (n-3)*(n-4)*(n-5) + (n-6)*(n-7)*(n-8)*(n-9) + ... + ...*(n-n).
0, 1, 2, 5, 10, 17, 32, 61, 110, 185, 316, 557, 986, 1705, 2840, 4661, 7702, 12881, 21620, 35965, 58706, 94217, 150016, 239045, 382670, 614401, 984332, 1564301, 2458810, 3826745, 5918936, 9136597, 14115686, 21842225, 33803620, 52181021, 80128082, 122221801, 185211440
Offset: 0
Keywords
Examples
a(2) = 2 + 1*0 = 2. a(3) = 3 + 2*1 = 5. a(9) = 9 + 8*7 + 6*5*4 + 3*2*1*0 = 9 + 56 + 120 = 185. a(11) = 11 + 10*9 + 8*7*6 + 5*4*3*2 = 557. a(18) = 18 + 17*16 + 15*14*13 + 12*11*10*9 + 8*7*6*5*4 = 21620.
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 0..1000
Programs
-
Mathematica
f[n_] := Sum[ Product[ n - k (k - 1)/2 - i + 1, {i, k}], {k, Sqrt[ 2n]}]; Array[f, 39, 0] (* Robert G. Wilson v, Jul 10 2013 *)
-
PARI
a(n)=sum(k=1,sqrtint(2*n)+1,prod(i=1,k,max(n-k*(k-1)/2-i+1,0))) \\ Charles R Greathouse IV, Jul 09 2013
-
Python
for n in range(55): sum = i = 0 k = 1 while i<=n: product = 1 for x in range(k): product *= n-i i += 1 if i>n: break sum += product k += 1 print(str(sum), end=',')
Comments