Project Euler : 91–95

This is an easy problem but a naive method would be very slow. So a little optimization is needed. A catch that will reduce your work almost ten-thousand fold is the fact that the sum of square of digits below ten million can never…


Project Euler : 86–90

This problem does not have something new, just like most other problems on ProjectEuler. I wrote a brute force algorithm and I don’t think there is any other way except checking every possibility. Pre-calculate all primes below 50…


Project Euler : 81–85

No doubt this is an interesting problem. To solve this I have populated all the cells of matrix from top to bottom, column-wise in each row. To reach any cell there are only two ways either from top or from left. Since I am populating…


Project Euler : 76–80

This is called Partition problem in number theory. Read the generating method here on Wikipedia and you can easily write code for this.


Project Euler : 71–75

I had already seen a problem of such kind on SPOJ here. So I knew this is called ‘Farey Sequence’. You can easily find neighbor of any fraction in Farey sequence, read this Wikipedia page.


Project Euler : 66–70

This is a harder version of problem 18. In problem 18, number of rows were only 15 but here 100. The algorithm does not need any change but the dimensions do. You can read strategy to solve problem 18 on this post of my blog.


Project Euler : 61–65

The first thought in your mind would be to write a brute force algorithm, but I wrote a clever one. Let me explain it without further boasting. Find nth root of smallest and largest ’n’ digit numbers (say a and b). Now we are sure that…


Project Euler : 56–60

For a language like Python, its a child play. So I used that and implemented my brute force algorithm which checks every number, raise its power and finds sum of digits in it. Gives answer in 1 second


Project Euler : 51–55

Without thinking much I first wrote a brute force algorithm and it gave answer within 2 seconds. But, a fact can reduce searching space. x and 6x will contain same digits, so number of digits in x and 6x should also be same. If x is…


Project Euler : 46–50

Don’t think much, go straight to the simple brute force algorithm. Since I had no idea about upper bound so instead of taking huge memory in code I stored primes below 1 million in file test2.txt and for each number from 2 to 1 million…

Project Euler
Project Euler
My solution to Project Euler problems
More information
Followers
18
Elsewhere