Giovanni Resta, March 20 2013. g.resta@iit.cnr.it Method used to determine that the full sequence A049101 is indeed: 1, 2, 3, 4, 5, 6, 7, 8, 9, 15, 18, 24, 45, 48, 135, 144, 288, 378, 476, 756, 864, 1575, 39366, 69984, 139968 Let me call sod(n) = sum-of-digits of n, and pod(n) = product-of-digits-of n. We want to determine all the numbers n such that n divides pod(n)*sod(n). First of all, we notice that sod(n) and pod(n) do not depend on the order of the digits of n. So we can use the following method. Let us fix a target number of digits, say 6 digits. We can generate all the possible sets of 6 nonzero digits. There are binomial(6+8,8) = 3003 such sets: 111111, 111112, ..., 889999, 899999, 999999. Given such a set, say 136899 we determine the minimum Min number that can be obtained with these digits, which is 136899 itself, and Mu = pod(136899)*sod(136899) = 419904. Now we look for numbers which divide 419904 and have 6 digits which, in some order, are exactly 136899. Since Mu can't be much larger than the number we are looking for, we can simply try Mu/1, Mu/2, Mu/3,... until Mu/k >= Min. Clearly, we will check the digits of Mu/k only if the division Mu/k is exact. In this case, Mu/1, Mu/2, Mu/3 and Mu/4 are equal to 419904, 209952, 139968, and 104976. The first two values are not good, because the digits do not match, the third is a solution and the fourth is < Min, so it tells us we have finished with this set of digits. To save some time the sets are build recursively, so at each step we already have the parzial sod, pod, Min, and the count of the digits. For example, if our target is 5 digits and we have a partial set 126 of 3 digits, with sum 9, product 12 and Min=126, we will expand it to the sets 1266, 1267, 1268 and 1269 propagating the updated sod and pod, and Min. In practice at each step we add a digit to the set which is equal or larger to the last digit added. This ensure that every set is generated exactly once. The number of sets to be checked become quite large when the number of digits increases. For example, for 80 digits we have binomial(88,8) = 64276915527 sets to check. To reduce this number we observe that most of these sets cannot lead to a solution, because they have Min > pod*sod, so there cannot be a number n >= Min which divides pod*sod. For example, we cannot have a solution with the set 1237 because 1237 > 1*2*3*7*(1+2+3+7) = 546. Clearly using this test after we have generated the set does not help. However, we can use this test to prune the recursive generation of the sets in the following way. Assume our goal is 8 digits and we have a partial set equal to 133. Now we need to determine the fourth digit, which in principle can be any digits from 3 to 9. The final Min will be at least 133*10^5 (actually at least 13333333, but it is easier to multiply the current Min by a power of 10). If the next digit is d, then the final pod*sod will be at most that of 133d9999, so, if 133*10^5 > (1*3*3) * d * 9^4 * (1+3+3+d+9*4), we know that using the digit d cannot lead to a solution. In this case this excludes d=3 and d=4, since we have 133*10^5 > pod(13339999)*sod(13339999) and 133*10^5 > pod(13349999)*sod(13349999). In this way we can reduce in a very dramatic way the sets to be generated and tested, expecially when considering large sets. With a simple implementation in C of this method I was able to test all the numbers up to 10^84 (the upper bound) in less than 0.5 seconds. The Mathematica implementation runs in about 1 minute. (end)