We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 9f93b33 + 629157b commit 137e4e9Copy full SHA for 137e4e9
javascript/0263-ugly-number.js
@@ -0,0 +1,9 @@
1
+var isUgly = function(n) {
2
+ if(n <= 0)
3
+ return false;
4
+
5
+ for(const p of [2, 3, 5])
6
+ while(n % p == 0)
7
+ n = n / p;
8
+ return n == 1;
9
+};
0 commit comments