Skip to main content

Posts

Showing posts from July, 2016
Project Euler Problem 6,7,8,9,10  in Java 6) Problem 6- Project Euler Solution in Java Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2640. Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum. My approach to the problem: public class squareDifference {    /*      * @euler project 6      * @author Niraj pate l      * /     public static void main(String[] args) {         int sum=0,sumSquare=0;         for(int num =1;num<101;num++){             sum+=num;             sumSquare+=num*num;         }         System.out.println(sum*sum - sumSquare);     } } 7) Problem 7- Project Euler Solution in Java By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? public class Prime {     /*      * @euler project 7      * @author Niraj pate l      */  
Project Euler Problem 1,2,3,4,5 in Java NOTE : Don't look at the solution if you had not tried it yourself. Because real learning is an active process and seeing how it is done is a long way from experiencing that epiphany of discovery.So you try possible solution but something doesn't work and it's hours now when that could be done in minutes. There is nothing wrong in looking at the solution if you have been doing it for long and couldn't figure it out. After looking the solution you may realize what bit of changes you could do for better result. It might be something very silly or stupid thing that you forgot and it's very frustrating.No matter how frustrating problems are, there is almost certainly a solution out there on web. These are my attempts or solution to the problems it might be simple or complex depending on how well you understand my algorithm. I have solved each problem using Java. It took me less than hour in some problems to design efficient