A number N is called highly composite if it has more divisors than any of the smaller numbers than N.
Few Highly composite numbers are:
1, 2, 4, 6, 12, 24, 36, 48, 60, 120….
Check if N is a Highly Composite number
Given a number N, the task is to check if N is a Highly Composite Number or not. If N is a Highly Composite Number than print “Yes” else print “No”.
Input: N = 60
60 is a highly composite because it has 12 divisors
and none of the numbers up to 59 has 12 or more divisors.
Input: N = 18
- Find the count of divisors of N
- Now in a loop from 1 to less than N, check for every i that if a number of divisors of i are more than the count of divisors of N, then return false
- Otherwise, return true at the end.
Below is the implementation of the above approach:
Time Complexity: O(n)
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Highly Totient Number
- Find a range of composite numbers of given length
- Split n into maximum composite numbers
- Generate a list of n consecutive composite numbers (An interesting method)
- Sum and Product of all Composite numbers which are divisible by k in an array
- Product of all the Composite Numbers in an array
- Sum and product of k smallest and k largest composite numbers in the array
- Composite numbers with digit sum 1
- Queries for the difference between the count of composite and prime numbers in a given range
- Find a sequence of N prime numbers whose sum is a composite number
- Represent the given number as the sum of two composite numbers
- Find two Composite Numbers such that there difference is N
- Sum of all composite numbers lying in the range [L, R] for Q queries
- Smallest composite number not divisible by first N prime numbers
- Composite Number
- Find the largest composite number that divides N but is strictly lesser than N
- Composite XOR and Coprime AND
- Find the maximum number of composite summands of a number
- Find the total number of composite factor for a given number
- Sum of elements in an array having composite frequency
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.