As Melody says, this is a very interesting and college-level advanced question in financial investments. As melody has shown, there a direct solution to it, but not many people have the skill in manipulating logs as Melody has done to arrive at the accurate solution.
One look at it, it immediately tells me what it is: It is the FV of two separate TVM formulae added together as one equation: Namely, It is the FV of $1,500 per year deposited at 7% annual rate + the FV of a fixed amount of $10,000 both for N number of years, which give a combined FV of $40,396.20.
I entered those 2 formulas into my computer and combined them. Then I entered all the known variables into the computer, and by using iteration and interpolation it came out, almost immediately with an N = 10.
And to check the result, I calculated them separately as follows:
1) $1,500 doposited @ 7% for 10 years gives a FV of =$20,724.67
2) $10,000 deposited @ 7% for 10 years gives a FV of=$19,671.51
3) Adding the two FV together:$20,724.67 + $19,671.51 =40,396.18 rounded to $40,396.2, which is spot on. CONGRATULATIONS TO MELODY!.
P.S. You should heed her advice of becoming a member, if you wish to have relatively complicated questions, such as this, answered by competent people.