Project Euler problems Logic and Solutions

As Wikipedia states Project Euler is a website dedicated to a series of computational problems intended to be solved by computer programs. Project Euler is a place for mathematicians, programmers and problem solvers who are passionate about solving problems. It contains 450+ programming challenges all of varying difficulty level. All problems can be solved in any programming language.

What makes Project Euler so special and difficult is the time restriction to solve a problem and the huge data range. Each problem must be solved withing few minutes (Less than 1 minutes if using C programming language).

Here I am providing basic idea and logic behind various Project Euler problems with full source code in Java. But always do remember one thing as also mentioned by Project Euler

"Use the Internet for learning purposes not for Copy/Pasting"

. Since Copy/Paste wont help you in creating/inventing something new while after learning you can definitely create something new.

Project Euler Archived Problems

  1. Multiples of 3 and 5
  2. Even Fibonacci numbers
Any doubt or suggestion write here. I will try my best to help. Before posting your code you must escape it to view. To format your source code and use format highlighting, post your source code inside
< pre>< code >----Your Source Code---- < / code > < / pre > (Remove spaces from pre and code tags)


  1. which data type is to be used to calculate 2 raise to the power 1000?

  2. "long long int " or "lomg float"

  3. "long long int " or "lomg float"

  4. then what we can write in long long int? mean i'm taking about %d,%ld???

  5. Replies
    1. pointers store the address of a variable in simple words... there are various use of pointers depending on various situation.learn more about pointer

  6. can a macro be used as a variable name?
    #define ONE TWO
    #define TWO ONE
    int ONE=1;
    int TWO=2;
    printf("%d %d", ONE,TWO);
    and why macro replacement is not done here

    1. Hello @Chandra mouli, you cannot use a macro as a full fledged variable. Variable has few properties that macro doesn't supports such as -
      1. Value of macro once initialized cannot be altered.
      2. You cannot point a pointer to the macro.
      3. Macro are defined at compiled time. While your variables are declared and allocated in memory at runtime.
      There are few more properties that macro doesn't supports. Hence you cannot use a macro as full fledged variable. But you can use it as a constant variable.

  7. how to get the pdf version of a pdf file using a cprogram