I’ve typically managed to get an invite from Google to all of their new products ever since I first got in on the second wave of GMail invites. I’ve now been invited to Google Wave and done my part to share the love by inviting 20 friends and co-workers.
First the obvious: Google Wave, without someone to “wave” with, is useless. So I’m very glad they’re letting new members invite a substantial amount of their personal network.
I haven’t yet used Wave for document collaboration, though I think it’s going to be one of the more interesting tasks I’m likely to perform on it. Currently it’s serving as a very nice IM/Email combination. It brings together the best of both worlds, instant updates and delayed reading if the other party isn’t there.
I’m also very Interested in seeing what types of gadgets people develop for it. Extensions to the base product are probably 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 seeing this gem of an error message:
Another Project Euler problem has been solved! This one almost made me feel guilty as I put the high level libraries of Python to use.
How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?
My code was short and sweet:
from datetime import datetime
d = datetime(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.weekday() == 6):
total_sundays += 1
Surprisingly, the code was also very fast:
[email protected]:~$ time python prob19.py
Project Euler Problem #52 was interesting and easy to solve. The problem states:
Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain the same digits.
My method of attack was to increment through the positive integers calculating the above products for each. The products were then converted into a string, broken into a list of characters, and finally sorted. The sorted version of the lists for each product were then compared to see if they were all the same. Python code is below.
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:
Worked on Project Euler Problem #23 last night. I was successful, though my brute force approach was less than speedy. Below is the not so pretty code. First, all abundant numbers below 28123 are found and appended to a list. Next, positive integers between 1 and 28123 that can not be the sum of two abundant numbers are found. These integers are marked as “valid.” The final step is to sum the valid integers and print the result.
I’m certainly curious as to methods that can improve this task.
abundant = 
valid = 
def contains(list, value):
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 abundant:
if num-j < 0:
if contains(abundant, num-j) > -1:
bad_number = True; break
if not bad_number:
print “Valid: “+str(num)
sum = 0
for num in valid:
sum += num