ricardoz17
I set up a python fiddle to mess about with this: http://pythonfiddle.com/st-petersburgh-paradox
One of the interesting things I found was that there is a power law for how much you would be willing to play the game. There are two ways to run the figures.
One is to never update your worth which produces (1,2.31)(2,5.80)(3,9.38)(4,12.78)(5,16.10)(6,19.43) - where (1,2.31) is an original worth of 10^1 and an expected value of 2.31.
The second is to update your worth after each winning bet: (1,1.94)(2,5.00)(3,8.48)(4,11.80)(5,15.11)(6,18.43)
In both instances a 10x increase in worth increase the expected value about 3.3-3.5. This may explain after you factor in the enjoyment of playing that it is rational for poorer people to play the lottery.
[1] One thing I didn't like about Prospect Theory is the steep curve for a loss this does not explain why people are so ready to buy insurance. If you use the above model if you could lose 90% of your value then -90/(-90+100) gives -9 and if you have to pay 1% then -1/(-1+100) gives -1/99 so you would do that for a 1/891 chance
<span id="code-desc">Next, return to TrainerLists and enter this PIN to complete the authorization process:</span>
<kbd aria-labelledby="code-desc"><code>7996044</code>
From there you can say that works fine with pen and paper but why might it go wrong in a program? So how do you avoid integer overflow? If the signs are the same then use subtract first else use addition first. After we have done that. After this step assume I have returned to the main flow. How do I check if I should use addition or subtraction? If a is bigger than b I must have added so use subtraction. Writing the algorithm this way is trickier than xor. The problems to be solved are to do with understanding concepts
Next you have the xor solution but more important than getting the answer to that might be to see if they can see that the two functions are like encrypt and decrypt where a is the message and b is a key and a + b is the ciphertext c - so that f(m,k) is encrypt and g(c,k) gives the message and g(c,m) gives the key. If they have had any exposure to cryptography then xor should present itself.
If they give xor straight off then you can work backwards.