7 kyu
Smooth numbers
132 of 1,277GiacomoSorbi
Description:
The concept of "smooth number" is applied to all those numbers whose prime factors are lesser than or equal to 7
: 60
is a smooth number (2 * 2 * 3 * 5
), 111
is not (3 * 37
).
More specifically, smooth numbers are classified by their highest prime factor and your are tasked with writing a isSmooth
/is_smooth
function that returns a string with this classification as it follows:
- 2-smooth numbers should be all defined as a
"power of 2"
, as they are merely that; - 3-smooth numbers are to return a result of
"3-smooth"
; - 5-smooth numbers will be labelled as
"Hamming number"
s (incidentally, you might appreciate this nice kata on them); - 7-smooth numbers are classified as
"humble number"
s; - for all the other numbers, just return
non-smooth
.
Examples:
is_smooth(16) == "power of 2"
is_smooth(36) == "3-smooth"
is_smooth(60) == "Hamming number"
is_smooth(98) == "humble number"
is_smooth(111) == "non-smooth"
The provided input n
is always going to be a positive number > 1
.
Number Theory
Similar Kata:
Stats:
Created | Jun 24, 2018 |
Published | Jun 29, 2018 |
Warriors Trained | 3222 |
Total Skips | 52 |
Total Code Submissions | 4113 |
Total Times Completed | 1277 |
JavaScript Completions | 290 |
Ruby Completions | 63 |
Crystal Completions | 8 |
Python Completions | 422 |
C++ Completions | 182 |
C Completions | 132 |
Java Completions | 213 |
C# Completions | 79 |
Total Stars | 46 |
% of votes with a positive feedback rating | 93% of 283 |
Total "Very Satisfied" Votes | 246 |
Total "Somewhat Satisfied" Votes | 33 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 4 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |