This line in my program:
invest(initial_amount,top_company(5,year,year+1)) = subsequent_amount
causes me to get this error:
You have done it backwards, it should be:
amount = invest(amount,top_company(5,year,year+1),year)