Harsh J

Memoirs of a QWERTY Keyboard

Look and Say Sequence

7 comments

Have no idea why it took near 2 hours for me to write this. Maybe it was the stupid OOP paper I gave today, I’ve been in a bad mood after writing a 40-pager and yet feeling unsatisfactory about it. :?

So back to the post’s topic: The Look and Say Sequence, which I found today while solving the level 10 of The Python Challenge, is a very odd sequence of numbers which are formed by counting and spelling out the digits sequentially.

The series looks like the following:

1 11 21 1211 111221 and so on …
How this is formed:
See the first digit 1. Spell it as One One (One in quantity that is). This is the general idea.
Thus:
1 – One One: 11
11 – Two One(s): 21
21 – One Two and One One: 1211
1211 – One One, One Two and Two One(s): 111221
And on and on and on …

And now, for the Python Code.

( Took me over 80 minutes with lots of scrapping and frustration to write. Bad day :( )

Written by Harsh

November 29th, 2007 at 1:17 am

7 Responses to 'Look and Say Sequence'

Subscribe to comments with RSS or TrackBack to 'Look and Say Sequence'.

  1. Hail PytHarsh!!

    YCR

    29 Nov 07 at 2:46 am

  2. What’s that? :P

    Python programs sound better if called Py[Name] than Pyt :P

    Harsh

    29 Nov 07 at 2:55 am

  3. Whoa thats a really strange sequence!! And i thought Fibonacci series (which I thought this was all about at first glance) was strange enough… Guess Fibonacci is much better than piece of cake compared to this….

    Beta3

    29 Nov 07 at 5:29 pm

  4. @Beta3: I think you’d like to take back your words sometime soon. :P There are very few things that are as strange and intriguing as the fibonacci numbers.

    have a look:
    http://mathworld.wolfram.com/FibonacciNumber.html

    anomit

    30 Nov 07 at 12:54 am

  5. Yeah Fibonacci series gives you the golden numbers :mrgreen:

    Harsh

    30 Nov 07 at 5:14 am

  6. lol, its golden ratio not golden number :D

    anomit

    30 Nov 07 at 7:11 pm

  7. Oops yeah, the number has something to do with calendars instead.

    Harsh

    30 Nov 07 at 7:52 pm

Leave a Reply