Awesome Developments

So, I’ve had the best week of my life and let me tell you folks, nothing’s better than sitting in front of one of the most awesome boxes in the world – the macbook pro. Yes, the alpha and the omega is here, I am now the proud owner of a macbook pro (not the new ones, this is the older version). So, here are the specs:

2.5 GHz

2 GB RAM (Vista was a PITA on 2 Gigs, OS X is such a beauty)

512 MB NVidia 8600M GeForce

Intel Core2Duo (obviously)

 

And so, here are a few select screenshots:

And of course:

And then comes:

By the way, that is how beautiful Komodo looks.

Then of course:

That is what iPhoto looks like. 

BTW, between a tough courseload which does not require me to use Python, I managed to squeeze some time for myself so I could automate a few modular arithmetic algorithms.

The first one I shall be dealing with is modular exponentiation. 

If we have ak mod n, then we can express it as
(a mod n)k mod n.

This allows us to express this in the form of code as:

#!/usr/bin/env python
#Author: Shriphani Palakodety
#Mail: spalakod@purdue.edu
#Blog: http://shriphani.com/blog

def modular(base, exponent, divisor):
        false_exponent = 0
        result = 1

        while false_exponent < exponent:
                result = ((base%divisor)*result)%divisor
                print result
                false_exponent+=1

        return result
 

Then of course comes finding the modular inverse using euclid’s algorithm:

def extended(a, b):
        if a % b == 0:
                return (0, 1)
       
        else:
                (x, y) = extended(b, a%b)
                return (y, x-y*(a/b))
 

That should return a tuple whose first element is the GCD. Well, I am going to have fun with the Macbook.


About this entry