Say you have an infinite amount of money in front of you. You can grab all you want, but if you grab more than some random variable, the money will vanish in a puff of smoke. What is the optimal strategy?
The problem has no practical relevance without time and the finite nature of the opportunity. Without time, you can just repeatedly grab a dollar until you are a billionaire. Without finite opportunity you can still grab relatively small multiples of cash and make a fortune.
It is the tradeoff between time and return, and the chance of detection that is interesting. Assuming variables are applied to the above considerations, is this reduceable to a formula. Has this problem ever been addressed in the literature before?
I have encountered a number of situations like this in the gambling world, where casino or sportsbook procedures had major procedural flaws, and the only barrier to making money was alerting the casino to the opportunity. However, in such situations, this becomes extremely likely. I was always left with the curiously unsatisfying feeling that I played my hand too aggressively or too meekly.

