Archive

Archive for October, 2008

Tweets del 23-10-2008

October 23rd, 2008 Serabe No comments
Categories: Twitter Tags:

Happiest day ever.

October 19th, 2008 Serabe 1 comment

I just want to say it somehow.

Categories: Amistades Peligrosas, Vida y Obra Tags:

Saddest pie ever

October 14th, 2008 Serabe 2 comments

Two weeks ago, a friend of mine came to Lund. One day, she asked me which movies I cried to. I answered that I didn’t remembered anyone (in fact, I didn’t).

Today, while I was watching the last episode (1×06) of True Blood, I remember that conversation because there is one of the saddest scenes I’ve ever watched. And it’s quite funny, because it’s just Anna Paquin eating half a pie. I won’t say anything else, because I don’t want to spoil the episode.

No More Pie

No More Pie

To my friend.

Categories: Series, TV Tags: , ,

Problem 3

October 12th, 2008 Serabe No comments

Wording: (Original) The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?

Solution:
First the code:

RUBY:
  1. include Math
  2. def prime_factors(num, factor=2)
  3.   return []  if num <= 1
  4.   next_pf = (factor..(sqrt(num).ceil)).find(lambda {num}){ |x| num%x == 0 }
  5.   return [next_pf] + prime_factors(num/next_pf, next_pf)
  6. end
  7.  
  8. puts prime_factors(600851475143).max

The code is a direct port from the one in PyEuler. It is based mainly in the idea that the first factor of a number is always prime.

Line 3 breaks recursion and line 4 works out the next prime factor (actually, it finds the smallest factor). For doing this, it uses find method. If no element match the criteria, then it returns the number (that is what the lambda block is for).

Finally, line 5 merges the results and line 8 print the result.

This time just one code is showed.

Tweets del 08-10-2008

October 8th, 2008 Serabe No comments
Categories: Twitter Tags:

Me Meme

October 3rd, 2008 Serabe 1 comment

While thinking about tomorrow programming contest, I made this photo with Photo Booth.
You can even see Vincent Vega behind me!

MeMeme

MeMeme


Via: Obie Fernández

1.Take a picture of yourself right now.
2. Don’t change your clothes, don’t fix your hair…just take a picture. (should be super-easy with Photobooth)
3. Post that picture with NO editing.
4 Post these instructions with your picture.

Categories: Vida y Obra Tags: , ,
Improve the web with Nofollow Reciprocity.