Is there a formula to determine the total number of constitutional isomers? Is there a trick or a formula that given a molecular formula, allows you to know exactly how many constitutional isomers can be formed with that many atoms? Or is it more of a trial-and-error technique?

I'm looking for something along the lines of $2^n$ of maximum number of possible stereo-isomers, where n is the number of stereogenic centers present in a compound.
There seems to be some confusion here : in order to determine the number of stereo-isomers of a molecular formula (say C4H11N) you would need to first know the number of constitutional isomers as you need to know how many stereogenic centers across all the structures.

There are a bunch of existing questions on constitutional isomers (a, b, c, ...) but the summary is : "it is tricky without software for anything more than very small formulae".

There are mathematical formulae for determining the count of constitutional isomers, although the most powerful techniques are non-trivial (such as those based on the Pólya enumeration theorem). To efficiently list a non-redundant set of compounds from an elemental formula is possibly even harder, as it requires a mechanism to avoid duplicates in the output.