0% found this document useful (0 votes)
7 views1 page

Project Euler Problems 1 & 2 Solutions

The document outlines a programming assignment for Java, focusing on solving the first two problems from Project Euler. Problem 1 involves finding the sum of all multiples of 3 or 5 below 1000, while Problem 2 requires calculating the sum of even-valued terms in the Fibonacci sequence that do not exceed four million. Both problems emphasize the use of loops, conditional statements, and arithmetic techniques.

Uploaded by

borat.asdfg
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Project Euler Problems 1 & 2 Solutions

The document outlines a programming assignment for Java, focusing on solving the first two problems from Project Euler. Problem 1 involves finding the sum of all multiples of 3 or 5 below 1000, while Problem 2 requires calculating the sum of even-valued terms in the Fibonacci sequence that do not exceed four million. Both problems emphasize the use of loops, conditional statements, and arithmetic techniques.

Uploaded by

borat.asdfg
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Project Euler Problems 1 & 2

Andrew Rosen

Welcome to your very first programming assignment for Java. For this as-
signment, we’ll be solving the first two problems from Project Euler. Project
Euler is a wonderful site, filled with many math and logic puzzles you will need
a computer program to solve. Some, like the first two, can serve as a great test
of understanding the fundamentals of a programming language. You can find
the problems at [Link] and you can create an account to confirm your
answers.
I have copied the problems below.

1 Problem 1: 65 points
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3,
5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples
of 3 or 5 below 1000.

1.1 Comments
This is a great problem! To solve it, you will need to use a loop, a conditional
statement with logic, modular arithmetic, and a running sum.

2 Problem 2: 35 points
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 considering the terms in the Fibonacci sequence whose values do not exceed
four million, find the sum of the even-valued terms.

2.1 Comments
Another good problem! It will need much of the same techniques as the previous
problem. My hint to you: you don’t know how fast the values will grow, so you
might find it much easier to use a while loop.

You might also like