A superior highly composite number is an integer where the ratio of its count of divisors to some power of the number is as high as possible. Expressing this as a formula:

Let d(n) be the number of divisors of n, including the number itself. For a given integer n, if there exists a number e such that d(n)/n^e is greater than or equal to d(k)/k^e for every integer k, then n is a highly composite number.

For more, see Superior highly composite number at Wikipedia, or A002201 at OEIS.

Here are the initial values:

2, 6, 12, 60, 120, 360, 2520, 5040, 55440, 720720, 1441440, 4324320, 21621600, 367567200, 6983776800, 13967553600, 321253732800, 2248776129600, 65214507758400, 195643523275200, 6064949221531200

Your challenge is to take an index n, and output the nth number in this sequence.

You may use 0 or 1 indexing, and you may make a program which is only correct up to the limits of your language's data type(s), as long as it can handle the first 10 values at a minimum.

This is code golf. Standard loopholes apply.


1 Answer 1


Mathematica, 277 bytes











Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.