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.
Problem 1 is really simple, in theory and I thought it would take me no more than half an hour to write a program to solve it in Python. However, I am completely unfamiliar with the syntax of Python and because I’m not a real programmer I didn’t really know what the proper names were for the sorts of things I wanted my program to do. I tried Googling for some documentation that would help me get my head around arrays in Python, and came up with some stuff about ‘lists’, which the BASIC part of my brain had trouble accepting…anyway, I cracked it after a few hours with a rather inelegant brute force method.
The thing I really like, apart from the excitement of typing in the answer and waiting to find out if it’s accurate, is the solution forum afterwards, where previous solvers share their method. I have found after solving problems 1 and 2 that it’s not only my knowledge of Python that limits my solutions, but my knowledge of Maths! I think I’ll learn a lot about maths and number theory as a result of this, which isn’t bad since I just wanted to learn Python.
Problem 3 is all about factorizing primes, of which I know nothing, so I think this one will take a little longer for me to crack. But I’m really enjoying learning something new. It is also confirming my suspicions about the way kids learn best (well, kids like me, anyway). I’m desperate to earn my level one badge, which is gained after one solves 25 problems. Also, that little public badge that proudly claims I’ve solved 2 so far is quite nice too!