write a code in JavaScript to find all prime factors of a input number.
Answers
Answered by
1
code of JavaScript. I hope it's help you please mark as a brainlist
Attachments:
AdiK1needy:
what is the second last statement, is it alert()?
Answered by
1
Explanation:
Answer:
Explanation:
# Python3 code to find nth ugly number
# This function divides a by greatest
# divisible power of b
def maxDivide( a, b ):
while a % b == 0:
a = a / b
return a
# Function to check if a number
# is ugly or not
def isUgly( no ):
no = maxDivide(no, 2)
no = maxDivide(no, 3)
no = maxDivide(no, 5)
return 1 if no == 1 else 0
# Function to get the nth ugly number
def getNthUglyNo( n ):
i = 1
count = 1 # ugly number count
# Check for all integers untill
# ugly count becomes n
while n > count:
i += 1
if isUgly(i):
count += 1
return i
Similar questions
English,
7 months ago
Math,
7 months ago
Computer Science,
1 year ago
Computer Science,
1 year ago
Math,
1 year ago
Chemistry,
1 year ago