\(a^2+b^2=\left(a+b\right)^2-2ab=5^2-2.4=17\)
\(a^3+b^3=\left(a+b\right)^3-3ab\left(a+b\right)=5^3-3.4.5=65\)
\(a^4+b^4=\left(a^2+b^2\right)^2-2.a^2b^2=17^2-2.4^2=257\)
=> \(a^7+b^7=\left(a^3+b^3\right)\left(a^4+b^4\right)-a^3b^3\left(a+b\right)=65.257-4^3.5=16385\)