Having been well established in the shooting hobby when the 1986 ban on production of full auto for civilians, the 1989 ban on importation of fun guns, the 1994 ban on high capacity magazines, and so forth ... the answer to "how many mags" is ALWAYS more than you think you need.
Magazines are wear items, expendable and do get lost or damaged.
Since AR15 magazines regularly go on sale for $8 to $9 I recommend buying 10 at a time when you find a deal. Once you hit 50 mags evaluate your other rifle supplies (ammo ... which will be harder to regulate than mags because 223 is a hunting caliber), quality of light / optic / sling.
For a person on a strict budget this is my "go to advice" ....
FOR EACH AR15 YOU OWN (THIS IS YOUR MINIMUM):
7 training mags
14 primary mags (this is two complete "load outs")
2,500 rounds of training ammo (replenish when you hit 1000 rounds)
1,000 rounds of defensive ammo
1 quality sling (example: BFG)
1 quality weapon mounted light (example: SureFire 600)
1 set of quality back-up sights (example: Troy, MBUS PRO, KAC)
1 quality optic (example: Aimpoint, ACOG)
1 quality cleaning kit (example: OTIS)
FOR EVERY THREE AR15 YOU OWN:
1 spare action spring
3 spare firing pin retainers
2 spare complete bolt assemblies
2 spare extractor with spring and o-ring
1 spare fire control assembly (2 pins, hammer, spring, trigger, spring, disco, spring)
2 spare charging handles
1 set buffers (carbine, H, H1, H2)
1 spare magazine release assembly
1 spare bolt catch assembly
2 spare buffer retainers with spring
1 spare castle nut
I started assembling AR15s in 1984 and the above is cumulative knowledge from 39 years of doing so. I shoot .. A LOT ... as in 2 to 3 times a week and as much as 20,000 rounds a year. If you do the above ... AS A MIN ... and start with a quality AR15 (like a BCM, Colt, Daniel Defense, KAC, LMT) you'll be set up well.
ETA:
Your target should be a minimum of 50 mags per rifle. At $8 each that is only $400. This is less than most of us spend on optics.
Don't waste money on upgrading your trigger until your mag supply is 50 (min) and your defensive ammo supply is 5,000 (min). Then drop $100-200 on a better trigger.