6 kyu

Multiples of 3 or 5

150,647 of 454,371jhoffner

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 a 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 Trained789953
Total Skips64019
Total Code Submissions1282621
Total Times Completed454371
JavaScript Completions139212
CoffeeScript Completions466
Ruby Completions10974
Clojure Completions1136
Python Completions150647
C# Completions31658
Java Completions53133
Haskell Completions3328
C++ Completions28926
Elixir Completions865
TypeScript Completions8831
PHP Completions9152
Swift Completions3042
Go Completions7321
Rust Completions5469
C Completions13994
R Completions739
Nim Completions100
F# Completions336
Scala Completions1195
Lua Completions652
Shell Completions648
PowerShell Completions343
Crystal Completions69
NASM Completions76
Julia Completions274
Kotlin Completions3413
Racket Completions149
Dart Completions2090
Factor Completions36
Prolog Completions71
Raku Completions36
COBOL Completions54
CommonLisp Completions160
D Completions30
VB Completions68
Groovy Completions18
Total Stars3668
% of votes with a positive feedback rating88% of 40759
Total "Very Satisfied" Votes32183
Total "Somewhat Satisfied" Votes7759
Total "Not Satisfied" Votes817
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