Your math is way off. I mean you got the intuition right that inflation means that money loses it's value, so a small number in the past is equivalent to a large number today.
But if you'd just add 60% to $40 then the result would be $64:
$40 + $40 *60%
$40 + $40 * 60/100 (percent = per centum = per hundred)
$40 * (1 + 60/100) = $40*(1+0.6) = $40*1.6= $64
Now that's too low, so either you're estimate of $40 is wrong and/or you're inflation rate is wrong (too low and or computed wrongly).
So if the cumulative inflation over the last 20 years would indeed be 60% then you'd need to solve the equation:
X *1.6 = 100
X = $100/1.6 = $100 / (160/100) = $100 * 100 / 160 = $62.5
However there is another problem in your calculation and that is that the assumption of a cumulative inflation of 60% is wrong because the 3% increase are applied every year so you have spill over effects. To drive home that point lets consider an inflation rate of 100% per year. So each year everything gets twice as expensive. Now with your naive assumption of a linear application of the inflation that would be 2000% or 20 times as expensive. However as it's applied each year, you'd not have to double the initial amount, but the amount of last year. So if you start with $1 twenty years ago, the next year that would correspond to $2, then to $4 the year after then to $8 then $16 and at year 5 you'd already exceed the x20 multiplier as it went to $32. After 20 year it would be at 2²⁰ or
2¹⁰*2¹⁰ = 1024*1024 = $1.048.576 (and yes I mean more than a million rather than $20!!!) so that the x20 multiplier seem negligible to the actual value.
So you have a kind of snowball effect or exponential growth. Now luckily the inflation is not 100% but just 3%, but this still means it's not 60% increase over 20 years but (1.03)²⁰ = 80.6% or if you started from your $40 it would be ~$72 instead of $64. Which is 20% more compared to the original $40 (20% of that = $8) and it's a 33% increase of the cumulated inflation compared to your estimate of 60% (60 * 1.33 = 80).
Which is still below 100 so the new number would be :
X *1.8 = 100
X = 100/1.8 = $55.56
Now last but not least what would be the inflation rate if it had been $40 twenty years ago and is $100 now? Well that would be:
40 * (1+X/100)²⁰ = 100
Now you divide both sides by 40:
(1+X/100)²⁰ = 100/40 = 5/2 = 2.5
Then you apply the logarithm to each side:
log((1+X/100)²⁰) = log(2.5)
And as for logarithms that exponential 20 is the same as multiplying with 20:
20*log(1+X/100) = log(2.5)
log(1+x/100) = log(2.5)/20
Now let's say you picked ln for the log than that would be:
ln(1+x/100) = 0.04581
apply exp to both sides (log and exp are not perfect equivalence operations so be careful here; but for our purposes it should work)
exp(ln(1+x/100) = exp(0.04581)
exp and ln cancel out:
1+x/100 = 1.04688
x = (1.04688 -1)*100 = 4.688
So you'd have an inflation rate of 4.688% per year. And while you should check out how logarithms work you could also just estimate it by checking 1.03²⁰ = 1.8 which is smaller than the expected 2.5, 1.04²⁰ = 2.191 which is still smaller than the 2.5 and for 1.05²⁰ = 2.65 it's already above 2.5 so it's somewhere between 4% and 5% closer to 5% and then you further pick numbers between that and see if the value is higher or lower than what you expect and continue until you're satisfied with the accuracy.
So yeah that kind of math is very important to keep in mind because 5% return on investment per year yields more than 100% over 20 years but even more importantly if you loan at 20% that's WAY more than paying 4 times what you loaned over 20 years (closer to 40 times). So be aware of those pitfalls.