6 kyu

Multiples of 3 or 5

137,253 of 447,296jhoffner

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 Trained776812
Total Skips63292
Total Code Submissions1265535
Total Times Completed447296
JavaScript Completions137253
CoffeeScript Completions465
Ruby Completions10915
Clojure Completions1133
Python Completions147845
C# Completions31267
Java Completions52338
Haskell Completions3309
C++ Completions28394
Elixir Completions855
TypeScript Completions8591
PHP Completions9053
Swift Completions3014
Go Completions7162
Rust Completions5370
C Completions13766
R Completions733
Nim Completions97
F# Completions331
Scala Completions1188
Lua Completions636
Shell Completions630
PowerShell Completions336
Crystal Completions68
NASM Completions75
Julia Completions271
Kotlin Completions3354
Racket Completions146
Dart Completions2037
Factor Completions36
Prolog Completions69
Raku Completions35
COBOL Completions53
CommonLisp Completions153
D Completions28
VB Completions63
Groovy Completions16
Total Stars3609
% of votes with a positive feedback rating88% of 40409
Total "Very Satisfied" Votes31896
Total "Somewhat Satisfied" Votes7703
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