li

Work hard, Play hard... et un peu de déconne!

Quand il n'est pas occupé par son herbier, le petit P sème des pierres blanches dans la forêt... Adepte de vieilles séries policères allemandes, il n'est pas peu commun de le trouver en train de manger la choucroûte devant la télé!


20 juin 2007

The cryptology riddle...

This one for the nerds (Hi D.N. v/o C.!)

While trying to figure out whether would split up a long sms to a beautiful girl that I am blessed to be able to call girlfriend, I stumbled across a non trivial problem:

How can I best count the characters in an sms in a text? Is there a system where I can easily find out which numbers the last characters are without counting for a long time? Say just looking at the last ten characters of any given sms, like the length of the last line of text on my mobile...

1) The most intuitive versions count alphabets while removing z and replacing y with a number. One sequence is 25 and the number says how many times you multiply 25 to find the overall length...

Example: "0abcdefghijklmnopqrstuvwx1abcdefghijklmnopqrstuvwx2abcdefgh..."

This system is easy but not very elegant (even worse if you use the full alphabet and make it a 27 or 28 sequence chain) and it doesn't satisfy the need to be looking only at the ten last chars to know how far I am at any given end of an sms...

2) Another quite intuitive way of putting it is the power of 2 scale, but it's a pain to type in and you have to quickly find a way of splitting or you end up with many 0's. Needless to say, it doesn't solve the problem of the last en chars either...

Example: "0102000300000004..."

3) The x multiple (space - zeros - the amount of times you have to multiply)

Example for the five multiple: " 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 0020..."

I think I found another solution that is less intensive to type and that can go to a thousand... Do you see what I am talking about? Can you find the optimal way of solving the problem?

Ciao, P

Libellés :