Yak Shaving

just me

Archive for November, 2008

Google App Engine

without comments

Struggling to make templates work. I want to conditionally include a section of html something that doesnt look possibble currently.

Written by channam

November 30th, 2008 at 3:21 pm

Posted in Uncategorized

ICM are Spammers

without comments

Despite being registered on TPS ICM and other “opinion” gathering companies are apparently exempt and can still dial you.

Written by channam

November 8th, 2008 at 4:43 pm

Posted in Uncategorized

Problem 4

without comments

#!/usr/bin/python

winners = []

for a in range (100, 999):
    for b in range (100, 999):
        test = str(a * b)
        if test == test[::-1]:
            winners.append(int(test))

print max(winners)

Written by channam

November 6th, 2008 at 12:49 am

Posted in code, project euler, python, random

Tagged with ,

Problem 3

with one comment

#!/usr/bin/python

def prime(n, start):
    factors = []
    while (n % start != 0):
        start = start + 1

    factors.append(start)

    if n > start:
        factors.extend(prime(n/start, start))

    return factors

print max(prime(600851475143, 71))

Written by channam

November 6th, 2008 at 12:48 am

Posted in code, project euler, python

Tagged with ,

Problem 2

without comments

#!/usr/bin/python

counter = 0

def fib(n):
    result = 0
    a, b = 0, 1
    for i in range(n):
        a, b = b, a + b
	if a < 4000000:
            if a%2 == 0:
                result += a
        else:
            return result

print fib(100000)

Written by channam

November 6th, 2008 at 12:48 am

Posted in project euler, python

Tagged with ,

Problem 1

without comments

#!/usr/bin/python

result = 0

for i in range (1, 1000):
	if i % 3 == 0 or i % 5 == 0:
		result += i 

print result

Written by channam

November 6th, 2008 at 12:44 am

Posted in code, project euler, python

Tagged with ,

Project Euler

without comments

I have started trying the projects on projecteuler.net Its been an interesting experiment. I chose Python as I need to brush up my skills a little. So the following posts will just be my solutions.

Written by channam

November 6th, 2008 at 12:43 am

Posted in Uncategorized