N = i^p,
where i,p are integers greater than 1;
and N is a positive integer with no repeat digits.
1) What is the largest possible value of 'N'?
2) What is the largest possible value of 'p'?
n='0123456789'; ct=0;
set=perms(n);
for i=1:length(set)
ft=factortable(str2double(set(i,:)));
good=true;
tst=gcd(sym(ft(:,2))) ;
if tst==1
good=false;
end
if good
ct=ct+1;
disp(set(i,:))
if ct>12
break
end
end
end
where
factortable.m is
function ft=factortable(x)
f=unique(factor(x));
f=f';
for i=1:length(f)
n=x; ct=0;
while mod(n,f(i))==0
ct=ct+1;
n=n/f(i);
end
f(i,2)=ct;
end
ft=f;
end
This finds
9814072356
33024
2 2
3 2
11 2
19 2
79 2
9761835204
49012
2 2
3 4
11 2
499 2
9814072356 is the highest found. It's the 33024th permutation tried, having started with the highest value. And the below table shows the prime factors, and the fact that each appears twice in the prime factorization, indicates it's a perfect square:
2 2
3 2
11 2
19 2
79 2
9761835204 is next and it's also a perfect square, having all even repetitions of its prime factors.
The same is true for
9614783025
113172
3 4
5 2
2179 2
9560732841
135541
3 2
11 2
2963 2
9351276804
220832
2 2
3 2
71 2
227 2
For part 2:
mxl=log(9876543210) ;
mxp=0;
for i=2:99380
mx=floor(mxl/log(i));
for p=mx:-1:2
N=char(string(i^p));
if isequal(unique(N),sort(N))
if p>=mxp
disp([i p str2double(N)])
mxp=p;
end
end
end
end
finds
2^29 = 536870912
where 29 is the largest p that would work.
|
Posted by Charlie
on 2022-07-22 12:56:28 |