exponential serie on updating a string

First, I was going to increment a string using this construction:

s = s + "xx...xxx"


Then the addition became more complex, and I decided to re-write updating as:

s = "%sxx...xxx" % (s, ...)


I run the program and found my Linux in a deep swap freeze. Fortunately, the system recovered, and I had a chance to find what happened.

The problem was that I was tired and actually wrote:

s = s + "%sxx...xxx" % (s, ...)


Have you ever heard about Wheat and Chessboard?

"What?! Just a grain of wheat! Are you insulting my wealth?" yelled the prince.

"No! Your majesty!" The Vizier explained. "You have to promise to double that grain of wheat until the chess board is full, so in the first day you give me one grain of wheat on the bottom right square of the chess board, on the second day you double it on the square next to it (giving me two grains), on the third, you double what is on the previous square (giving me four grains), and so on, until the Sixty Fourth square on the chess board."

"I would thought you being so smart", the young prince said. "You would ask for something more substantial. Anyway, if this is your wish I will grant you that.

Never though this story can affect me.

Categories:

Updated: