Let N
0=348364879.
The digital product of N, that is, the product of its nonzero digits, is P0=3483648, which is contained within N0.
Find additional examples of numbers that contain their own digital products, with N0<N1<N2<N3... and P0<P1<P2<P3...
The program finds the product of each set of digits that has zero to 3 of each digit 2 through 6 and zero through 2 of each digit 7 through 9.
The program tests each such product to see if there are enough of the above specified digts to form the product. If it does, it reports the product and the full digit set to get the product. The product can also include up to three 1's. Except for a modification I made, the program would allow up to three zeros as well, but there are plenty of other digit combinations that padding with zeros is not that necessary.
clc
for d2=[1 2 4 8]
p=d2;
for d3=[1 3 9 27]
p2=p*d3;
for d4=[1 4 16 64]
p3=p2*d4;
for d5=[1 5 25 125]
p4=p3*d5;
for d6=[1 6 36 216]
p5=p4*d6;
for d7=[1 7 49]
p6=p5*d7;
for d8=[1 8 64]
p7=p6*d8;
for d9=[1 9 81]
p8=p7*d9;
neededstr=char(string(p8));
availstr=[repmat('2',1,log(d2)/log(2)) ...
repmat('3',1,round(log(d3)/log(3))) ...
repmat('4',1,log(d4)/log(4)) ...
repmat('5',1,round(log(d5)/log(5))) ...
repmat('6',1,round(log(d6)/log(6))) ...
repmat('7',1,log(d7)/log(7)) ...
repmat('8',1,log(d8)/log(8)) ...
repmat('9',1,log(d9)/log(9)) ...
'000' '111'];
good=true;
availhold=availstr;
for i=1:length(neededstr)
ix=strfind(availstr,neededstr(i));
if isempty(ix)
good=false;
break
end
availstr(ix(1))='x';
end
if good
if isempty(strfind(neededstr,'0'))
disp(p8)
disp(availhold(1:end-6))
disp(' ')
end
end
end
end
end
end
end
end
end
end
Finds necessary digits to produce such numbers. It specifically excludes embedded zeros.
The first non-trivial set found is
18816
67788
1881677 is one such number.
Another example:
1575 is the product of the digits in 5579, and thus also of 15759 (or 91575)
If we take examples of these and put them in the order of the products, the corresponding N's can be made to be in the same order by appropriate inclusions of the a given number of 1's at the end to make small numbers larger.
Other sets:
139968
3346899
11664
334669
144
3344
3483648
334467889
1316818944
334466778899
135
3335
13395375
3335557799
13716864
3334667789
2
2
128
288
112
278
12
26
6912
26889
672
2678
186624
2466899
16128
246678
14112
246677
14112
244779
124416
2446899
trivial and non-trivial. This is a small portion of the list.
As a final example of the conversion, the set immediately above gives, for an example:
Product 124416 with included digits 2446899, as in 912441698 or say 91244169811.
Products that include zeros were explicitly excluded, as it seemed odd to ignore them in the multiplication, as in:
Product 11760 with included digits 56778, as in 71176085.
|
Posted by Charlie
on 2023-11-25 13:46:18 |