The common difference can be found from
[tex]d=\dfrac{a_{17}-a_{7}}{17-7}=\dfrac{81-41}{17-7}=\dfrac{40}{10}=4[/tex]
The first term of the sequence can be found from either of the given terms.
[tex]a_{7}=41=a_{1}+(7-1)d=a_{1}+24\\a_{1}=41-24=17[/tex]
The sum of 40 terms is
[tex]S_{40}=\dfrac{40}{2}(a_{1}+a_{40})=20(17+(17+39\cdot 4)=20\cdot 190=3800[/tex]
The sum of the first 40 terms is 3800.