Determine all triplets (X, Y, Z) of base 12 positive integers such that the duodecimal representation of X
Y*(X+1)
Z has no leading zeroes and contains each of the digits from 0 to B exactly once, with the restriction that: at least one of Y and Z is different from 1.
What is the total number of such triplets without any restriction?
clearvars,clc
largest=base2dec('ba9876543210',12);
lowval=base2dec('1023456789ab',12);
for x1=1:21000
y1=floor(log(lowval)/log(x1));
p1=x1^y1;
while y1<log(largest)/log(x1)
for x2=[x1+1 x1-1]
if x2>1
y2=floor(log(lowval/p1)/log(x2));
p2=x2^y2;
while p1*p2<largest
v=p1*p2;
if v>=lowval && v<=largest && v==floor(v)
duo=dec2base(v,12);
if isequal('0123456789AB',unique(duo))
disp([x1,y1,x2,y2])
disp([dec2base(x1,12) ' ' dec2base(x2,12)])
disp(v)
disp(duo)
disp(' ')
end
end
y2=y2+1;
p2=p2*x2;
end
end
end
y1=y1+1;
p1=p1*x1;
end
end
shows
287 4 286 1
1BB 1BA
1940410518046
2740936815BA
17380 2 17381 1
A084 A085
5250181336400
70962B1345A8
meaning 1BB^4 * 1BA^1 = 2740936815BA
and A084^2 * A085^1 = 70962B1345A8
In decimal, that's
287^4 * 286^1 = 1940410518046
and
17380^2 * 17381^1 = 5250181336400
|
Posted by Charlie
on 2023-04-20 21:48:13 |