Line 1: Line 1:
 +
[[Category:Euler Project]]
 +
[[Category:MA375]]
 +
 
== Problem 1  ==
 
== Problem 1  ==
  
----
+
<div style="background: none repeat scroll 0% 0% rgb(238, 238, 255); border-width: 1px 1px 1px 4px; border-style: solid; border-color: rgb(68, 68, 136) rgb(68, 68, 136) rgb(68, 68, 136) rgb(51, 51, 136); width: 30em; padding: 2em; margin: auto; text-align: left;">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.
 +
</div>
  
<br> '''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.'''
+
 
 +
This is a gentle first problem, but it is designed to illustrate what project Euler is really about.
 +
 
 +
Recall that story of Little Gauss who was asked by his teacher to add all the digits up to 100. Contrary to the teacher's expectation of enjoying a short respite from nagging of her students who would be busily using their fingers and toes to add up the numbers, Little Gauss came up with the correct answer in matter of seconds. He had found a simple formula for adding the sum of digits up to n. Better yet, his formula could add up all the digits up to 100, 1000, or even 12123897129371927391287 in matter of seconds- it had a constant run time no matter the input n.
 +
 
 +
We want to approach each problems like our Little Gauss, always looking for more graceful, elegant, and compact solutions.
  
 
----
 
----
 +
'''Naive Approach'''
 +
 +
[[MA 375 Spring 2012 Walther Project Euler|Back to Project Euler]]
 +
 +
[[2012 Spring MA 375 Walther|Back to MA375]]

Revision as of 15:30, 28 January 2012


Problem 1

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.


This is a gentle first problem, but it is designed to illustrate what project Euler is really about.

Recall that story of Little Gauss who was asked by his teacher to add all the digits up to 100. Contrary to the teacher's expectation of enjoying a short respite from nagging of her students who would be busily using their fingers and toes to add up the numbers, Little Gauss came up with the correct answer in matter of seconds. He had found a simple formula for adding the sum of digits up to n. Better yet, his formula could add up all the digits up to 100, 1000, or even 12123897129371927391287 in matter of seconds- it had a constant run time no matter the input n.

We want to approach each problems like our Little Gauss, always looking for more graceful, elegant, and compact solutions.


Naive Approach

Back to Project Euler

Back to MA375

Alumni Liaison

Have a piece of advice for Purdue students? Share it through Rhea!

Alumni Liaison