6 kyu

Multiples of 3 or 5

138,787 of 452,737jhoffner

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

Similar Kata:

Stats:

CreatedMar 21, 2013
PublishedMar 28, 2013
Warriors Trained786832
Total Skips63851
Total Code Submissions1278672
Total Times Completed452737
JavaScript Completions138787
CoffeeScript Completions466
Ruby Completions10964
Clojure Completions1135
Python Completions149952
C# Completions31565
Java Completions52965
Haskell Completions3325
C++ Completions28813
Elixir Completions863
TypeScript Completions8783
PHP Completions9132
Swift Completions3034
Go Completions7285
Rust Completions5443
C Completions13948
R Completions738
Nim Completions100
F# Completions336
Scala Completions1194
Lua Completions647
Shell Completions640
PowerShell Completions341
Crystal Completions69
NASM Completions75
Julia Completions273
Kotlin Completions3392
Racket Completions149
Dart Completions2079
Factor Completions36
Prolog Completions70
Raku Completions36
COBOL Completions54
CommonLisp Completions159
D Completions30
VB Completions67
Groovy Completions18
Total Stars3657
% of votes with a positive feedback rating88% of 40686
Total "Very Satisfied" Votes32118
Total "Somewhat Satisfied" Votes7752
Total "Not Satisfied" Votes816
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