6 kyu

Multiples of 3 or 5

149,476 of 451,481jhoffner

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 Trained784606
Total Skips63719
Total Code Submissions1275460
Total Times Completed451481
JavaScript Completions138405
CoffeeScript Completions466
Ruby Completions10952
Clojure Completions1135
Python Completions149476
C# Completions31508
Java Completions52835
Haskell Completions3320
C++ Completions28698
Elixir Completions860
TypeScript Completions8738
PHP Completions9118
Swift Completions3030
Go Completions7254
Rust Completions5424
C Completions13912
R Completions737
Nim Completions100
F# Completions335
Scala Completions1193
Lua Completions645
Shell Completions637
PowerShell Completions341
Crystal Completions69
NASM Completions75
Julia Completions272
Kotlin Completions3384
Racket Completions149
Dart Completions2070
Factor Completions36
Prolog Completions70
Raku Completions35
COBOL Completions54
CommonLisp Completions157
D Completions30
VB Completions67
Groovy Completions18
Total Stars3648
% of votes with a positive feedback rating88% of 40616
Total "Very Satisfied" Votes32065
Total "Somewhat Satisfied" Votes7737
Total "Not Satisfied" Votes814
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