Problem 27: Quadratic primes in the form of n^2+an+b. Now I rewrote Python, and tried it in Haskell. My Haskell code runs slowly. I will try to learn in the forum.
Monday, April 22, 2013
Friday, April 19, 2013
Sunday, April 14, 2013
Monday, April 08, 2013
Sunday, April 07, 2013
Wednesday, December 26, 2012
Saturday, December 15, 2012
I do not have anything new, but I read about it this morning and I want to memorize it.
def hammingproblem(p,q,r,n): a,b,c = 0,0,0 t =  for k in xrange(1, n+1): x = p*t[a] if x > q*t[b]: x = q*t[b] if x > r*t[c]: x = r*t[c] if x == p*t[a]: a += 1 if x == q*t[b]: b += 1 if x == r*t[c]: c += 1 t.append(x) return t print hammingproblem(2,3,5,100)
n is the size of the sequence. (a,b,c) is the indexes of the candidate for a new number for (p,q,r). It is impressive to see the numbers in t are sorted.
Thursday, November 29, 2012
Tuesday, November 06, 2012
I have a three-year-old Kindle2 device. I have bought some books, not a lot, from Amazon. And I put some PDF files in it. I like Kindle books because of their looks, but I do not like PDFs, because fonts are too small. I usually print unsolved problems from Project Euler into a PDF formatted file and put it in my Kindle2. I tried something different. There is the 'kindlegen' program to create Kindle formatted files. You can see a description here:
Kindle Publishing Programs
So I save the unsolved problems page in html, and just do:
$ kindlegen Project\ Euler.html
This creates Project\ Euler.mobi, and you can see it in Kindle devices and Kindle viewers. It seems there is difference in created htmls by browsers, and I use Google Chrome for this purpose. The file looks nicely in Kindle for Mac, but looks somewhat broken in the Kindle2 device, but still much better than PDF files.