Motivation … Found !!!

Alright so I think I have the motivation again to restart blogging . My next post will start off with that .

I need to post again, just need the right motivatio

follow me on twitter

Project Euler 63

Some more one liner fun.

I first had the program looking like this:-

total = 0
for x in range(1,10):
    for n in range(1,51):
        if n == len(str(x**n)):
            total += 1
print (total)

After a good look, I was able to reduce it to a 1 liner:-

import time
r = time.time()

print(sum(len(str(x**n)) == n for x in range(1,10) for n in range(1,51)))

print ( time.time() - r )

The parenthesis around print sure does require some getting used to.

Project Euler 43

While working on euler functions, i have managed to come up with quite a library of functions that I use to solve problems.

Today I was playing around with Python 3.0 to see how many of the libraries can be converted, refactored or removed while utilizing the new features of python. First one that can potentially go is the permutations function since itertools now has one.

So here is my ( brute force ) solution to 43 using the permutations from itertools . Takes around 15 seconds to execute

import time
from itertools import permutations


def checkForProperty(t):


    if (int(t[1:4])%2) != 0:
        return False
    
    if(int(t[2:5])%3) != 0:
        return False

    if (int(t[3:6])%5) != 0:
        return False

    if(int(t[4:7])%7) != 0:
        return False

    if(int(t[5:8])%11) != 0:
        return False

    if(int(t[6:9])%13) != 0:
        return False

    if(int(t[7:10])%17) != 0:
        return False

    return True
    



r = time.time()

print (sum([int(''.join(x)) for x in permutations('1234567890') if x[0] != '0' and checkForProperty(''.join(x))]))

print (time.time() - r)

Project Euler #41

After a while I went back to Project Euler to solve a problem. Boy those are addicting. Had some fun with the fairly simple #41

The idea was to find the largest n-digit pandigital that is also a prime. A n-digit number is pandigital if it makes use of all the digits 1 to n exactly once

Based on the simple isPrime rule I was able to rule out 8 digit and 9 digit pandigitals. This is because the sum of the numbers is evenly divisible by 9, sum(1..9) = 45 and sum(1..8) = 36. So this left me with the possibility that n <= 7 . Here is the python code I used to find it:-

def isNPandigital(number):
    return set( [int(c) for c in str(number)]) == set(range(1,len(str(number))+1))


t = time.time()
primes = sieve(7654321)
answerSet = []

print &#8220;primes generated&#8221;

for prime in primes:
    if isNPandigital(prime):
        answerSet.append(prime)

print max(answerSet)
print time.time() &#8211; t

Opera mini and gmail

why can’t I access my gmail accounts via opera mini but fine with the default browser ?

Been playing with the phone a little bit more over this weekend. I found 2 remote programs for S60, one being Salling Clicker and the other called Remote’Em All . Since remote is free ill be trying that and see how is it to set up VLC over wifi.

As for browsers, I tried the default browser, Opera Mini and Skyfire. Skyfire felt very laggy , slow and had some rendering issues. On the other hand opera mini is the superstar, fast rendering and havent come across a problem site yet. The default browser is also good, but if you are going to browse the web Opera Mini is the way to go

Remote For Nokia E71

Does any one know of some good software ( freeware 🙂 ) that can act as a remote control for VLC or window media player over the lan ? Been hunting for something on the phone since I watch movies on my laptop connected to a big screen and it would be nice to control the playback over the air from the phone….any ideas ?

New Phone

So after a lot of research I finally went ahead and bought my first Nokia phone, the E71 . I bought it close to a month ago, and love it. Its packed with software and is amazingly good looking as well. Ill start posting more about the applications I have played it and my overall experience as a first time Symbian user after having used pretty much only Sont Ericsson phones in the past.

Previous page (6 / 37) Next page (8 / 37)