What you need is a rafter span table, if by beam you mean the rafters, and you are using dimensional lumber. Not sure if you mean a span of 25'; if so that may be pretty substantial, esp. If snow load is a thing where you are...
If you mean the beam supporting the outer end of the rafters, you'll not be getting a 40' unsupported span.. and will need to do some math.
Rob Roy's 'Timber Framing for the Rest of Us' has some good content for this, but I am sure there are plenty of other options.
'Theoretically this level of creeping Orwellian dynamics should ramp up our awareness, but what happens instead is that each alert becomes less and less effective because we're incredibly stupid.' - Jerry Holkins