Multiples of 3 and 5 redux
Description:
The galactic games have begun!
It's the galactic games! Beings of all worlds come together to compete in several interesting sports, like nroogring, fredling and buzzing (the beefolks love the last one). However, there's also the traditional marathon run.
Unfortunately, there have been cheaters in the last years, and the committee decided to place sensors on the track. Committees being committees, they've come up with the following rule:
A sensor should be placed every 3 and 5 meters from the start, e.g. at 3m, 5m, 6m, 9m, 10m, 12m, 15m, 18m….
Since you're responsible for the track, you need to buy those sensors. Even worse, you don't know how long the track will be! And since there might be more than a single track, and you can't be bothered to do all of this by hand, you decide to write a program instead.
Task
Return the sum of the multiples of 3 and 5 below a number. Being the galactic games, the tracks can get rather large, so your solution should work for really large numbers (greater than 1,000,000).
Examples
10 should return 23 because 23 = 3 + 5 + 6 + 9
20 should return 78 because 78 = 3 + 5 + 6 + 9 + 10 + 12 + 15 + 18
Similar Kata:
Stats:
Created | Jan 18, 2015 |
Published | Jan 18, 2015 |
Warriors Trained | 5410 |
Total Skips | 324 |
Total Code Submissions | 12780 |
Total Times Completed | 2011 |
Python Completions | 937 |
JavaScript Completions | 776 |
Haskell Completions | 161 |
Ruby Completions | 130 |
COBOL Completions | 11 |
C Completions | 113 |
NASM Completions | 11 |
Total Stars | 129 |
% of votes with a positive feedback rating | 92% of 324 |
Total "Very Satisfied" Votes | 277 |
Total "Somewhat Satisfied" Votes | 39 |
Total "Not Satisfied" Votes | 8 |