Skip to content

Instantly share code, notes, and snippets.

@epoch
Created July 13, 2014 23:17
Show Gist options
  • Select an option

  • Save epoch/de321553867d5667aff8 to your computer and use it in GitHub Desktop.

Select an option

Save epoch/de321553867d5667aff8 to your computer and use it in GitHub Desktop.

Sum of Multiples

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.

Write a program that, given a number, can find the sum of all the multiples of 3 or 5 up to and including that number.

Allow the program to be configured to find the sum of multiples of numbers other than 3 and 5.

Source

A variation on Problem 1 at Project Euler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment