Ah. The inverse square law only applies to things that radiate in all directions, like the sun or an explosion. It's used to calculate how the energy drop as you move away from a source that is is expanding freely (it probably applies to freely expanding wedges of energy too). It doesn't apply to directed energy weapons. In a perfect vacuum, a perfectly directed energy weapon will never lose energy. Of course those conditions never apply, but in space at least, you can fire a directed energy weapon a long way with little loss in power. In fact, you could fire it light years and if the beam didn't expand so much that it was unable to hit you with the entire width of the beam (it doesn't get bigger than you, for instance) it would still apply all of its energy, less that absorbed by interstellar hydrogen (which isn't all that much in the grand scheme).