Join us

@thenjikubheka ă» Oct 20,2021 ă» 1 min read ă» 847 views ă» Originally posted on thenjiwekubheka2.medium.com

When preparing for a Technical interview with one of The Big Tech Companies; Amazon, Google, Facebook, Netflix, Microsoft, itâs vital to practice with resources such as Project Euler.

Project Euler is a series of challenging mathematical and computer programming problems that require more than just mathematical insights to solve.

Now letâs start with our first task, which can be solved using the language of your choice, I will be using Python.

**Task 1: Multiples of 3 or 5**

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.

**Solution:**

So the question is asking us to add all the natural numbers(values that are divisible by 3 or 5 and have no remainders).

Our range is 1 to 1000.

Letâs create a variable called sum:

Then create a For loop, and include the range function to count from 0 to 1000.

Then we have our conditional statement that will check for numbers divisible by 3 or 5.

Then we want to increment the sum, which is all the multiples of 3 and 5, from 0 to 1000.

Then lastly we want to print all those numbers.

Our total will be: 233168

Join other developers and claim your FAUN account now!

Mathematician | Software Engineer | Amazonian| Open Source | Blogger | Ban Killer Robots

Influence

Total Hits

Posts

Only registered users can post comments. Please, login or signup.