While solving a math-based programming problem, I had to write a function to compute the maximum number of distinct prime factors for any number in the range $[1, n]$ for any number $n$.
I tested this function with some basic inputs, namely, the powers of $10$.
I noticed that for $n = 10^a$, this function outputs $a + 1$. In other words, the maximum number of prime factors for any number in the range $[1, 10^a]$ is $a + 1$.
Why is this true and does this pattern persist with higher powers of $10$? (I only tested upto $a=8$)
PS: Please let me know if this the right way to present my question and if there are any ways to improve it!
The maximum number $k$ of distinct prime factors of a number $m\le n$ is attained when $m$ is the product of the first $k$ primes. So to find $k$, just keep multiplying successive primes until you reach a number greater than $n$.
Your conjecture remains true as long as the product of the first $a+1$ primes has $a$ decimal digits: $$2\times3=6$$ $$2\times3\times5=30$$ $$2\times3\times5\times7=210$$ $$\cdots$$ $$2\times3\times5\times7\times11\times13\times17\times19=9,699,690$$ But it fails for the first time at $$2\times3\times5\times7\times11\times13\times17\times19\times23=223,092,870$$ and is false for all higher values of $a$.