Monday, November 17, 2014

Project Euler memo: Problem 473

Problem 473: Hunting for easy problems. It was easy to program and it runs in one minute and half in Golang. How can you make it faster? I read the forum and felt ashamed. There is much better way.

Monday, November 10, 2014

Project Euler memo: Problem 487

Problem 487: Easy, but it took me one week to finish. 14 seconds in Golang.

Sunday, November 02, 2014

Project Euler memo: Problem 485

Problem 485: First my solution runs in 140 minutes! I learned in the forum how bad I was. Now it takes just 30 seconds. Written in Golang.

Saturday, October 11, 2014

Project Euler memo: Problem 497

Problem 497: Easy problem. It had been nearly two years for me to solve a unsolved problem. 30 seconds in Python.
---
(update 10/12/2014)
1.5 seconds in Go. Struggled with integer overflow.

Saturday, September 27, 2014

go language

I have been looking for a replacement for the C language. I like its speed but it does not have some important data structures such as list and associative array. I feel C++ and Java are somewhat ugly. I read a little bit of the code of docker by chance, which is written in the go language, then I thought it looks good to learn. 

So I read through "An introduction to Programming in Go", I actually bought the book for Kindle, and I went through from the problem 1 to 7 of Project Euler. This is not the first time for me to use the language, but I think the command was little different when I used it 4 years ago. Did it have "go run" option? Anyway I learned how to create a package today. I put my functions like Gcd and Is_prime in my new package. I needed to struggle with GOPATH value but the package is working now.

Saturday, June 07, 2014

Problem 49

Problem 49: Prime permutations. 0.2 seconds in Python. One liner however one minute in Haskell.

Sunday, June 01, 2014

redoing a problem: 47

Problem 47: Distinct prime factors. Two seconds in Python, which is about the same as the previous code.


Friday, May 02, 2014

redoing problems: 48, 50

Problem 48: Self powers.  One line in both Python and Haskell.

Problem 50: Consecutive prime sum. Two lines in both Python and Haskell. One second and 30 seconds respectively.

Thursday, May 01, 2014

redoing problems: 44, 45, 46

Problem 44: Pentagon numbers. I actually read the forum and learned. 3 seconds in Haskell.

Problem 45: Triangular, pentagonal and hexagonal. 3 minutes in Haskell.

Problem 46: Goldbach"s other conjecture. Less than a second with one line in Haskell.

Sunday, April 27, 2014

redoing a problem: 96

Problem 96: Sudoku. It"s 30 lines in Python. I wrote in Haskell also. It"s 27 lines. The Python code runs in 18 seconds for the 50 problems and the Haskell code runs in 78 seconds.