6 kyu

Multiples of 3 or 5

147,919 of 447,502jhoffner

Description:

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.

Finish the solution so that it returns the sum of all the multiples of 3 or 5 below the number passed in.

Additionally, if the number is negative, return 0.

Note: If the number is a multiple of both 3 and 5, only count it once.

Courtesy of projecteuler.net (Problem 1)

Mathematics
Algorithms

Stats:

CreatedMar 21, 2013
PublishedMar 28, 2013
Warriors Trained777203
Total Skips63307
Total Code Submissions1265989
Total Times Completed447502
JavaScript Completions137305
CoffeeScript Completions465
Ruby Completions10922
Clojure Completions1134
Python Completions147919
C# Completions31272
Java Completions52367
Haskell Completions3310
C++ Completions28408
Elixir Completions856
TypeScript Completions8598
PHP Completions9057
Swift Completions3015
Go Completions7170
Rust Completions5373
C Completions13774
R Completions733
Nim Completions97
F# Completions333
Scala Completions1188
Lua Completions637
Shell Completions632
PowerShell Completions337
Crystal Completions68
NASM Completions75
Julia Completions271
Kotlin Completions3355
Racket Completions147
Dart Completions2039
Factor Completions36
Prolog Completions69
Raku Completions35
COBOL Completions53
CommonLisp Completions154
D Completions28
VB Completions64
Groovy Completions16
Total Stars3609
% of votes with a positive feedback rating88% of 40416
Total "Very Satisfied" Votes31900
Total "Somewhat Satisfied" Votes7706
Total "Not Satisfied" Votes810
Ad
Contributors
  • jhoffner Avatar
  • OverZealous Avatar
  • curtmack Avatar
  • dnolan Avatar
  • Azuaron Avatar
  • fenra Avatar
  • Osmosis Avatar
  • Metal Wing Avatar
  • anter69 Avatar
  • lechevalier Avatar
  • Chrono79 Avatar
  • kazk Avatar
  • kleidemos Avatar
  • B1ts Avatar
  • CajetanP Avatar
  • Firefly2002 Avatar
  • calebkleveter Avatar
  • leometzger Avatar
  • user9040298 Avatar
  • rowcased Avatar
  • mentalplex Avatar
  • dolgov_vv Avatar
  • kdmatrosov Avatar
  • Bubbler Avatar
  • metagn Avatar
  • JavaCommons Avatar
  • bassopenguin Avatar
  • spudboy Avatar
  • hobovsky Avatar
  • user3029010 Avatar
  • Console Cowboy Avatar
  • uniapi Avatar
  • stellartux Avatar
  • tonylicoding Avatar
  • user8436785 Avatar
  • y0sik Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
  • Kacarott Avatar
  • dfhwze Avatar
  • NikCSharp Avatar
  • Captain Quack Avatar
  • JavaScripts Avatar
Ad