Consider an=∫−1n(1+2x+3x2+…+nxn−1)dx for every n∈N.
Integrating term by term and using that the integrand is k=1∑nkxk−1, we obtain
an=∑k=1nk1∫−1nxk−1dx=∑k=1nk1⋅kxk−1n=∑k=1nk2nk−(−1)k
For n=1,
a1=1211−(−1)1=11+1=2
Since 2∈/(2,30) (the interval is open), n=1 is excluded.
For n=2,
a2=121−(−1)+422−1=13+43=3+0.75=3.75
Since 3.75∈(2,30), n=2 is included.
For n=3,
a3=131+1+432−1+933+1=14+48+928=4+2+928=6+928=982≈9.11
Since 9.11∈(2,30), n=3 is included.
For n=4,
a4=14+1+416−1+964+1+16256−1
=5+415+965+16255=5+3.75+7.22+15.94=31.91
Since 31.91>30, n=4 is excluded.
For n≥4, the dominant term n2nn grows extremely fast, so an>30 for all n≥4.
The set of natural numbers for which an∈(2,30) is {2,3} and its sum is
Sum=2+3=5
The answer is 5.