I'm trying to fully understand the formula for gen 1 stats. It all makes sense except I'm having a hard time understanding what "statexp" is in the formula. Can someone help me understand?

Stat EXP is essentially EV’s in gen 1. The way they worked was actually simple. When you defeat a Pokémon, you get Stat Exp equivalent to the Pokémon’s amount of that specific stat. I know this is confusing but let me give you an example.

If you beat a Mew, you will get 100 stat exp for each of your stats. If you recall Mew’s stats, you’ll notice that it’s stats are all 100. So this means you get stat exp equivalent to your opponents stats.

I know this is a bit confusing, but read this Source for further understanding. It is in the Stat Exp section

Hope I helped.