First Google Wave Experience

I’ve typ­i­cally man­aged to get an invite from Google to all of their new prod­ucts ever since I first got in on the sec­ond wave of GMail invites. I’ve now been invited to Google Wave and done my part to share the love by invit­ing 20 friends and co-workers.

First the obvi­ous: Google Wave, with­out some­one to “wave” with, is use­less. So I’m very glad they’re let­ting new mem­bers invite a sub­stan­tial amount of their per­sonal network.

I haven’t yet used Wave for doc­u­ment col­lab­o­ra­tion, though I think it’s going to be one of the more inter­est­ing tasks I’m likely to per­form on it. Cur­rently it’s serv­ing as a very nice IM/Email com­bi­na­tion. It brings together the best of both worlds, instant updates and delayed read­ing if the other party isn’t there.

I’m also very Inter­ested in see­ing what types of gad­gets peo­ple develop for it. Exten­sions to the base prod­uct are prob­a­bly going to be what truly gives it value.

It’s most assuredly a beta though. I’ve already lost all the edits I’ve made in a wave and had to retype them after see­ing this gem of an error message:


Problem #19

Another Project Euler prob­lem has been solved! This one almost made me feel guilty as I put the high level libraries of Python to use.

How many Sun­days fell on the first of the month dur­ing the twen­ti­eth cen­tury (1 Jan 1901 to 31 Dec 2000)?

My code was short and sweet:

from date­time import date­time

d = date­time(1901,1,1)

total_sundays = 0

for yr in range(1901,2001):
    d = d.replace(year=yr)
    for m in range(1,13):
        d = d.replace(month=m)
        if(d.week­day() == 6):
            total_sundays += 1

print total_sundays

Sur­pris­ingly, the code was also very fast:

[email protected]:~$ time python
[[answer snip]]
real 0m0.086s
user 0m0.012s
sys 0m0.000s
[email protected]:~$

Problem #52

Project Euler Prob­lem #52 was inter­est­ing and easy to solve.  The prob­lem states:

Find the small­est pos­i­tive inte­ger, x, such that 2x, 3x, 4x, 5x, and 6x, con­tain the same digits.

My method of attack was to incre­ment through the pos­i­tive inte­gers cal­cu­lat­ing the above prod­ucts for each.  The prod­ucts were then con­verted into a string, bro­ken into a list of char­ac­ters, and finally sorted. The sorted ver­sion of the lists for each prod­uct were then com­pared to see if they were all the same. Python code is below.


import sys

for x in range(126000,250000):
    a2 = list(str(x*2)); a2.sort()
    a3 = list(str(x*3)); a3.sort()
    a4 = list(str(x*4)); a4.sort()
    a5 = list(str(x*5)); a5.sort()
    a6 = list(str(x*6)); a6.sort()

    if a2 == a3 == a4 == a5 == a6:
        print “True! x=”+str(x)
        print “a2 “+.join(a2)+” “+str(x*2)
        print “a3 “+.join(a3)+” “+str(x*3)
        print “a4 “+.join(a4)+” “+str(x*4)
        print “a5 “+.join(a5)+” “+str(x*5)
        print “a6 “+.join(a6)+” “+str(x*6)
        if x % 500 == 0:
print “Com­plete”

Problem #23

Worked on Project Euler Prob­lem #23 last night. I was suc­cess­ful, though my brute force approach was less than speedy. Below is the not so pretty code. First, all abun­dant num­bers below 28123 are found and appended to a list. Next, pos­i­tive inte­gers between 1 and 28123 that can not be the sum of two abun­dant num­bers are found. These inte­gers are marked as “valid.” The final step is to sum the valid inte­gers and print the result.

I’m cer­tainly curi­ous as to meth­ods that can improve this task.


abun­dant = []
valid = []

def con­tains(list, value):
    except Val­ueEr­ror:
    return idx

for x in range(2,28123):
    sum = 1
    for n in range(2,x/2+1):
        if x % n == 0:
            sum += n
    if sum > x:

for num in range(1,28123):
    bad_number = False
    for j in abun­dant:
        if num-j < 0:
        if con­tains(abun­dant, num-j) > -1:
            bad_number = True; break
    if not bad_number:
        print “Valid: “+str(num)

sum = 0
for num in valid:
    sum += num
print str(sum)