An easier variation of the formula you describe would be to just take a particular level's expected gain and add it to the previous level's expected wealth. Figuring out they determined a particular level's expected total wealth is not too hard, but it doesn't really get us any closer to levels beyond 40 because the expected wealth gain seems to be an arbitrary number.
It's totally possible I've missed some key ingredient to the pattern. If anyone wants to take a real stab at deriving a formula, here's what you've got to do:
First look at the average treasure by encounter and level on page 51 of the DMG. You can take each of those numbers, multiply them by 13.5 (the typical number of encounters per level), then divide by 4 (the typical party size), then find 90% of the result (because it's assumed that you spend 10% of your wealth on consumable items like arrows and potions.) The answer you come up with for each level will closely resemble the projected wealth gain per level table on page 54 of the DMG.
If you want to determine the expected wealth for a given level, say 19th, then you would add up all the expected wealth gain numbers from 1 to 18 and the figure you arrive at, in theory, should be the same as the Expected Wealth table entry on page 135. Unfortunately, though that usually matches, it sometimes won't, which has led me to believe that there are either typos or some other kind of mistake in their tables.
If you really want to determine expected wealth, you'll have to determine average treasure per encounter for levels beyond 40. That is the really tricky part. On page 53, under the entry for randomly determining 20th level treasure, there is a small table for determining random treasure for levels 21 to 30 by adding a number of Major Magical Items. If you look at that table, it almost seems like you can see a pattern in the number of Items added, but not quite. The number of items added from levels 31 to 40 could probably be backward calculated from the Expected Wealth table on page 209, but at this point, I feel pretty confident that no pattern would emerge.
If you manage to read this post from top to bottom and don't fall asleep, you'll have good luck for the rest of the day!