Benny's Adventures

in Programming: Project Euler, Problem 1 (Python 3.0)

http://projecteuler.net

Problem 1:
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.

This isn’t a problem that can be done very quickly by hand, so let’s just let the code speak for itself:

import timeit,time

start=time.time()

sum=0;
counter=0;
while counter<1000:
if counter%3==0 or counter%5==0:
sum=sum+counter
counter+=1

print(sum)

print(time.time()-star)

The time tools let me time how long it takes. When running this from the command prompt I get a time of .0019998550415 seconds, and it gets the right answer (which I’ll leave out in case you don’t want the spoiler).
Does anyone have a better way of getting code published on here?

28 June 2010 Posted by | Programming | , , , , | Leave a comment

on the Internet: Wireless Broadband Availability Expanding!

Source: http://www.nytimes.com/2010/06/28/technology/28broadband.html?src=busln&pagewanted=all

President Obama is moving forward with an initiative that makes more frequencies available for wireless use. This could mean the rise of broadband services that bypass the limits of wired infrastructure and eventually transcend wired networks with advancing wireless technology.

I just hope this means that more broadband initiatives could pass (assuming this passes, of course) and leads to increasing speeds to keep us competitive with the rest of the world.

It will be interesting to see how Congress responds to this.

28 June 2010 Posted by | Internet | , , , | Leave a comment

in Music: The Swinger

http://musicmachinery.com/2010/05/21/the-swinger/

This little wonder takes any song you have and converts it into a swing beat. Check it out because it is really wonderful and kinda surreal to listen to songs like Daft Punk’s Around the World or Journey’s Don’t Stop Believing in swing rather than straight.

28 June 2010 Posted by | Music | , , | Leave a comment

   

%d bloggers like this: