Sphenic NumberA Sphenic Number is a positive integer n which is a product of exactly three distinct primes. The first few sphenic numbers are 30, 42, 66, 70, 78, 102, 105, 110, 114, ... Given a number n, determine whether it is a Sphenic Number or not. Examples: Input: 30Output : YesExplanation: 30 is the smalles
8 min read
k-th prime factor of a given numberGiven two numbers n and k, print k-th prime factor among all prime factors of n. For example, if the input number is 15 and k is 2, then output should be "5". And if the k is 3, then output should be "-1" (there are less than k prime factors). Examples: Input : n = 225, k = 2 Output : 3 Prime factor
15+ min read
Find all factors of a Positive NumberGiven a positive integer n, find all the distinct divisors of n.Examples:Input: n = 10 Output: [1, 2, 5, 10]Explanation: 1, 2, 5 and 10 are the divisors of 10. Input: n = 100Output: [1, 2, 4, 5, 10, 20, 25, 50, 100]Explanation: 1, 2, 4, 5, 10, 20, 25, 50 and 100 are divisors of 100.Table of Content[
7 min read