
Recent Posts
Recent Comments
Archives
Categories
Meta
Category Archives: Project Euler
Projecteuler.net – Problem 26 – Java
Log in to view this post.
Posted in Java, Project Euler
Leave a comment
Projecteuler.net – Problem 63 – Java
http://projecteuler.net/problem=63 This one seemed straight forward and doable with very little code. I like that. Simply solve the math then compare the length of the result to power value. Josh
Posted in Java, Project Euler
Leave a comment
Projecteuler.net – Problem 46 – Java
http://projecteuler.net/problem=46 Lots of code follows. Not as slim as it might have been if I did it in a procedural way. But I’m trying to make and reuse as much code as possible for later problems. What I’ve done is … Continue reading
Posted in Java, Project Euler
Leave a comment
Projecteuler.net – Problem 44 – Java
http://projecteuler.net/problem=44 I populated a Set with a range of Pentagonal numbers that I thought might contain the result. Then I check if the Sums and Differences are already in the Set. This method is not optimum as it will end … Continue reading
Posted in Java, Project Euler
Leave a comment
Projecteuler.net – Problem 45 – Java
http://projecteuler.net/problem=45 I just solved each equation for the variable I was trying to find. Then, if the ‘solution modulo 1′ equals 0, I know I have a whole number. Since we know the first Triangle number that works is 285, … Continue reading
Posted in Java, Project Euler
Leave a comment
Projecteuler.net – Problem 41 – Java
http://projecteuler.net/problem=41 Made use again of Lexicographic permutation so I put it in a class of its own. I also created a Prime class that checks if a number is prime. I kind of lucked out and didn’t have to check … Continue reading
Posted in Java, Project Euler
Leave a comment
Projecteuler.net – Problem 43 – Java
http://projecteuler.net/problem=43 I recycled some code from the previous problem I worked on that used Lexicographic permutations. This will just cycle through all the possibilities without repeats and maintain the ‘pandigitalness’ of the number we are starting with. If I find … Continue reading
Posted in Java, Project Euler
Leave a comment
Projecteuler.net – Problem 24 – Java & Python 3
http://projecteuler.net/problem=24 This problem involves lexicographic permutation. I tried my hand coding it both in Java and Python. The python code is noticeably more compact, but is also really slow. I followed an algorithm on lexicographic permutation found on Wikipedia. Generation … Continue reading
Posted in Java, Project Euler, Python
Leave a comment
Projecteuler.net – Problem 3 – Java
http://projecteuler.net/problem=3 I played around with creating a function for prime factorization that I can carry forward for future problems. Needs minor work to catch numbers that you shouldn’t pass to it. I’m also playing with JavaDoc as well. Still trying … Continue reading
Posted in Java, Project Euler
Leave a comment
Projecteuler.net – Problem 2 – Java solution
http://projecteuler.net/problem=2 Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, … By … Continue reading
Posted in Java, Project Euler
Leave a comment