7 kyu

Find the divisors!

39,880 of 89,134kwy95

Description:

Create a function named divisors/Divisors that takes an integer n > 1 and returns an array with all of the integer's divisors(except for 1 and the number itself), from smallest to largest. If the number is prime return the string '(integer) is prime' (null in C#, empty table in COBOL) (use Either String a in Haskell and Result<Vec<u32>, String> in Rust).

Examples:

divisors(12) --> [2, 3, 4, 6]
divisors(25) --> [5]
divisors(13) --> "13 is prime"
Mathematics
Algorithms

More By Author:

Check out these other kata created by kwy95

Stats:

CreatedOct 25, 2014
PublishedOct 25, 2014
Warriors Trained165016
Total Skips18530
Total Code Submissions288686
Total Times Completed89134
JavaScript Completions39880
CoffeeScript Completions160
Haskell Completions1200
Python Completions35192
Ruby Completions4218
Rust Completions1712
Elixir Completions300
C# Completions3075
PHP Completions3762
C Completions729
COBOL Completions9
Dart Completions65
Lua Completions33
TypeScript Completions111
Total Stars856
% of votes with a positive feedback rating89% of 8861
Total "Very Satisfied" Votes7148
Total "Somewhat Satisfied" Votes1562
Total "Not Satisfied" Votes151
Ad
Contributors
  • kwy95 Avatar
  • jhoffner Avatar
  • xcthulhu Avatar
  • user578387 Avatar
  • bkaes Avatar
  • GiacomoSorbi Avatar
  • donaldsebleung Avatar
  • aweleshetu Avatar
  • Chrono79 Avatar
  • davejones Avatar
  • Voile Avatar
  • Madjosz Avatar
  • Souzooka Avatar
  • firerain42 Avatar
  • rowcased Avatar
  • monadius Avatar
  • hobovsky Avatar
  • trashy_incel Avatar
  • kirull Avatar
  • DanielRomanMartinez Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
  • metatable Avatar
  • Cameron637 Avatar
Ad