Problem 1 Lyrics

The problem:
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.

The Math:

We know that if a number n is multiple of m, n/m must return an integer since the remainder of the division is 0.

The Coding:

Python

We can go in two different ways:

1) We can create a if statement that checks if the result we obtain by dividing the number for 3 or 5 is an integer. If it's not, it means that it's a float and therefore the remainder ≠ 0.

2) We can use the module function, which is a function that returns the remainder of n/m.

What we need to do now is writing a loop that goes through all the numbers from 1 to 1000 and analyzes them.

Once we established which numbers satisfy our condition, we need to sum them. In order to do so, we can store them inside a list and then sum all the items in it; this will require the function sum from the module math. Another way is creating a variable that increases its value after each number is analyzed and prints it out once it's done.

The number that is printed at the end is our solution.

How to Format Lyrics:

  • Type out all lyrics, even repeating song parts like the chorus
  • Lyrics should be broken down into individual lines
  • Use section headers above different song parts like [Verse], [Chorus], etc.
  • Use italics (<i>lyric</i>) and bold (<b>lyric</b>) to distinguish between different vocalists in the same song part
  • If you don’t understand a lyric, use [?]

To learn more, check out our transcription guide or visit our transcribers forum

About

Genius Annotation

Every page will not give the solution of the problem not the exact code needed to solve it.

Problems can be solved in various way and coding languages, and everyone has its preferences. If you solved it in a different way or in a different language, edit the lyrics and include it!

Project Euler Website

Q&A

Find answers to frequently asked questions about the song and explore its deeper meaning

Comments