tl;dr: Output the values where the reduced prime factorization leader changes.
Every positive integer has a unique prime factorization. Let's call the reduced prime factorization just the list of multiplicity of the prime factors, ordered by the size of the factors. For instance, the reduced prime factorization of 1980
is [2, 2, 1, 1]
, because 1980 = 2 * 2 * 3 * 3 * 5 * 11
.
Next, let's record how often each reduced prime factorization happens, over integers in [1, 2, ..., n]
. For instance, in [1, 2, ..., 10]
, the following reduced prime factorizations occur:
[1]: 4 (2, 3, 5, 7)
[2]: 2 (4, 9)
[1, 1]: 2 (6, 10)
[]: 1 (1)
[3]: 1 (8)
We'll call the leader up to n
the reduced prime factorization that occurs the most often over [1, 2, ..., n]
. Therefore, the reduced prime factorization leader for n = 10
is [1]
. Ties will be broken by the size of the largest integer less than or equal to n
with that reduced prime factorization, with smaller largest integer being better. For instance, up to n = 60
, the reduced prime factorizations [1]
and [1, 1]
occur 17 times each. The maximum integer in that range giving [1, 1]
is 58
, while the maximum integer giving [1]
is 59
. Therefore, with n = 60
, the reduced prime factorization leader is [1, 1]
.
I'm interested in the values of n
where the reduced prime factorization leader changes. Those are the values of n
where the reduced prime factorization leader is different from the reduced prime factorization leader up to n-1
. As an edge case, we will say that the leadership changes at n = 1
, because a leader does not exist for n = 0
.
Your challenge is to output.
An initial sequence of the desired output is:
1, 3, 58, 61, 65, 73, 77, 1279789, 1280057, 1280066, 1280073, 1280437, 1280441, 1281155, 1281161, 1281165, 1281179, 1281190, 1281243, 1281247, 1281262, 1281271, 1281313, 1281365
Allowed output styles are:
- Infinite output.
- The first
k
leader changes, wherek
is the input. - The
k
th leader change, wherek
is the input.
k
may be zero or one indexed.
This is code-golf. If you're not sure about anything, ask in the comments. Good luck!
n
where the reduced prime factorization leader is different from the reduced prime factorization leader up ton-1
") \$\endgroup\$