Saddest pie ever

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.

Problem 3

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]
include Math
def prime_factors(num, factor=2)
return [] if num <= 1 next_pf = (factor..(sqrt(num).ceil)).find(lambda {num}){ |x| num%x == 0 } return [next_pf] + prime_factors(num/next_pf, next_pf) end puts prime_factors(600851475143).max [/ruby] 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.

Me Meme

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.