Computing how many distinct digital products are below $10^n$
This is basically OEIS sequence A154323 representing central coefficients of number triangle A113582. The OEIS page gives the following formula:
$$a_n = \frac{n^4 + 2n^3 + n^2 + 4}4=1+\binom{n+1}{2}^2$$
The is actually the formula provided by Empty2, just with a different starting index ($n$ instead of $n+1$).
Even without a closed form solution, you can count the number of distinct products with just a few lines of code. I have decided to choose Java because since Java8 it's very easy to employ all existing CPU cores in stream-based computations which shortens computation times significantly.
import java.math.BigInteger;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class Application {
public static final int N = 100;
static Set<BigInteger> getUniqueProducts(int generation) {
Set<BigInteger> result = new HashSet<>();
if(generation == 0) {
result.add(BigInteger.ONE);
}
else {
Set<BigInteger> products = getUniqueProducts(generation - 1);
result = products.stream().parallel().flatMap(
product -> IntStream
.range(0, 10)
.mapToObj(String::valueOf)
.map(s -> new BigInteger(s))
.map(num -> num.multiply(product))
).collect(Collectors.toSet());
}
System.out.println("10^{" + generation + "} & " + result.size() + "\\\\");
return result;
}
public static void main(String[] args) {
System.out.println("\\begin{array}{c|l}");
System.out.println("\\text{Below} & \\text{Distinct digital products}\\\\\\hline");
getUniqueProducts(N);
System.out.println("\\end{array}");
}
}
Here are the results up to $n=80$:
$$\begin{array}{c|l} \text{Below} & \text{Distinct digital products}\\\hline 10^{0} & 1\\ 10^{1} & 10\\ 10^{2} & 37\\ 10^{3} & 101\\ 10^{4} & 226\\ 10^{5} & 442\\ 10^{6} & 785\\ 10^{7} & 1297\\ 10^{8} & 2026\\ 10^{9} & 3026\\ 10^{10} & 4357\\ 10^{11} & 6085\\ 10^{12} & 8282\\ 10^{13} & 11026\\ 10^{14} & 14401\\ 10^{15} & 18497\\ 10^{16} & 23410\\ 10^{17} & 29242\\ 10^{18} & 36101\\ 10^{19} & 44101\\ 10^{20} & 53362\\ 10^{21} & 64010\\ 10^{22} & 76177\\ 10^{23} & 90001\\ 10^{24} & 105626\\ 10^{25} & 123202\\ 10^{26} & 142885\\ 10^{27} & 164837\\ 10^{28} & 189226\\ 10^{29} & 216226\\ 10^{30} & 246017\\ 10^{31} & 278785\\ 10^{32} & 314722\\ 10^{33} & 354026\\ 10^{34} & 396901\\ 10^{35} & 443557\\ 10^{36} & 494210\\ 10^{37} & 549082\\ 10^{38} & 608401\\ 10^{39} & 672401\\ 10^{40} & 741322\\ 10^{41} & 815410\\ 10^{42} & 894917\\ 10^{43} & 980101\\ 10^{44} & 1071226\\ 10^{45} & 1168562\\ 10^{46} & 1272385\\ 10^{47} & 1382977\\ 10^{48} & 1500626\\ 10^{49} & 1625626\\ 10^{50} & 1758277\\ 10^{51} & 1898885\\ 10^{52} & 2047762\\ 10^{53} & 2205226\\ 10^{54} & 2371601\\ 10^{55} & 2547217\\ 10^{56} & 2732410\\ 10^{57} & 2927522\\ 10^{58} & 3132901\\ 10^{59} & 3348901\\ 10^{60} & 3575882\\ 10^{61} & 3814210\\ 10^{62} & 4064257\\ 10^{63} & 4326401\\ 10^{64} & 4601026\\ 10^{65} & 4888522\\ 10^{66} & 5189285\\ 10^{67} & 5503717\\ 10^{68} & 5832226\\ 10^{69} & 6175226\\ 10^{70} & 6533137\\ 10^{71} & 6906385\\ 10^{72} & 7295402\\ 10^{73} & 7700626\\ 10^{74} & 8122501\\ 10^{75} & 8561477\\ 10^{76} & 9018010\\ 10^{77} & 9492562\\ 10^{78} & 9985601\\ 10^{79} & 10497601\\ 10^{80} & 11029042\\ \end{array}$$
...and a chart:
...also using logarithmic scaling:
The product is $2^a3^b5^c7^d$ where $a/3+b/2+c+d\le n$, with an adjustment for 6s, so what is the volume of a four-dimensional simplex?
Except for $n=0$, the numbers in @Oldboy's answer follow $$1+{n+2\choose 2}^2$$
I don't know why.