Correct me if I'm wrong, but I thought mining coins took power as time went on. Thus what it took to do the job in the past isn't what it would take today and thus past mining really wouldn't be comparable.
The difficulty (amount/cost of power required) goes up over time when the price goes up because more miners join the network as it becomes more profitable, which means that on average new coins are produced more often. The network targets a certain rate of production and it does this by increasing the difficulty.
If the price drops and miners leave this will happen in reverse and coins will not be produced fast enough, then the difficulty will reduce (meaning less power is required to mine a block). The network would be fine even back at $100.
Does the math to calculate a coin change based on... price?
For some reason I assumed the mathematical difficulty just naturally increased as part of what in my mind is "the mathematical problem" vs. number of coins.
No, the difficulty is based on the average rate of generation of blocks over the last few weeks.
If people put less computational power into generating blocks, fewer blocks will be generated. After each n blocks, nodes adjust their difficulty based on how long it took to generate those blocks, to try and achieve an average of a block every 10 minutes.
But how much computational power people are willing to put in depends on price. It only makes sense to mine if you get more out than you put in in the cost of buying the hardware, amortized over the life of the hardware, plus the cost of the power used in mining. If the price of Bitcoin drops, there are fewer people for whom it makes economic sense to continue mining, so some will turn off their miners, reducing the hash rate.
When global hash rate reduces like this, and the difficulty drops, then the people remaining will get more BTC per unit time from mining, so it can make economic sense for them to continue mining, as long as the price doesn't drop further. So indirectly, the total hash power of the bitcoin network is linked to the price of bitcoin; or, the price of bitcoin relative to the price of electric power.
> Does the math to calculate a coin change based on... price?
Indirectly.
> "the mathematical problem"
The mathematical problem is producing blocks. A block is a collection of transactions and a bit of metadata, including the address which gets the block reward. The block is hashed along with a counter or random factor (nonce), which is manipulated to try to find a sha-256 output with a certain number of leading 0 bits. The number of zeroes required by the network is the difficulty (this may be somewhat oversimplified).
Hashing has costs, hardware and power mostly. When the price of BTC rises such that the expected income is greater than the expected costs, people switch on more equipment and the network hashrate goes up.
As the hashrate goes up, the difficulty is adjusted by the network in order to keep the new block finidng time at about 10 minutes. If the price falls, miners find it unprofitable, go offline, the hashrate drops and then the difficulty also drops to keep the block time about the same. In this way the costs and rewards balance out.
But this also means that as the price of BTC rises, so does its (already huge) power consumption.
Not exactly, but they loosely correlate. Difficulty changes with overall hash rate. There have been times when the hash rate was increasing even as the price was going down. Miners have a different profitability calculus than investors/speculators.