What is the first 12-digit sequence in the duodecimal expansion of pi that contains each digit exactly once?
(In reply to
new solution by Steven Lord)
clearvars,clc
digits 40000
srce=vpa(pi);
had=[];
for i=1:32000
had=[had floor(srce)];
fprintf('%d ',floor(srce));
if mod(i,50)==0
fprintf(' ')
fprintf('%5d ',i)
end
if length(had)>12
had=had(end-11:end);
end
if length(unique(had))==12
disp(' ')
disp(' ')
disp(i)
disp(had)
break
end
srce=(srce-floor(srce))*12;
end
confirms Steven Lord's solution
30300 6 5 4 8 1 0 9 4 11 2 9 2 6 9 10 1 10 10 2 3 4 8 4 4 11 8 3 8 10 10 7 2 6 5 2 10 6 4 4 8 10 6 10 3 7 7 9 8 0 3
30350 1 0 7 10 7 10 0 5 2 4 8 9 7 4 10 10 7 0 3 2 8 2 2 11 9 6 11 9 8 10 9 2 11 6 11 9 6 11 8 2 2 2 9 0 3 3 4 9 7 0
30400 4 6 2 10 6 5 8 10 0 9 6 8 0 6 0 0 11 11 9 5 6 1 8 0 2 7 2 11 7 0 6 0 3 2 3 6 8 6 6 8 11 2 1 7 0 7 11 4 1 6
30450 6 0 3 9 6 7 6 11 1 8 3 6 9 2 2 5 1 1 10 4 4 8 1 11 5 4 1 3 5 10 4 5 5 8 6 3 8 3 10 10 7 8 9 7 4 2 4 4 11 4
30500 2 6 6 5 4 10 8 8 9 0 11 4 1 8 6 11 8 3 8 9 4 10 4 6 4 4 0 0 5 8 6 5 5 4 11 10 11 8 4 3 1 5 11 9 1 6 6 0 6 4
30550 3 1 11 6 8 8 9 9 4 5 5 5 9 11 9 8 9 11 4 1 5 5 6 4 5 6 11 1 4 10 7 11 6 6 10 0 6 0 5 4 9 5 9 7 2 6 9 2 4 3
30600 9 0 4 8 6 5 4 7 9 9 9 2 4 11 5 10 5 7 9 6 8 9 11 3 2 11 6 8 3 9 9 10 10 1 6 8 6 6 2 4 2 8 2 8 6 8 9 1 4 10
30650 7 0 2 2 4 2 10 9 4 11 4 9 11 7 10 8 9 1 0 7 0 2 5 4 2 1 4 4 7 7 10 5 8 11 4 0 1 7 8 3 9 1 8 9 3 0 2 3 3 4
30700 5 11 4 9 6 1 10 3 4 8 4 10 6 4 6 3 4 5 3 8 10 3 1 7 5 4 7 2 9 6 3 7 1 4 9 6 8 9 2 7 10 6 3 7 6 11 8 7 4 6
30750 1 2 7 9 10 2 8 9 11 5 3 7 0 6 8 3 2 1 9 7 5 11 4 10
30774
[0, 6, 8, 3, 2, 1, 9, 7, 5, 11, 4, 10]
>>
The 30774 refers to the position of the last of these digits (10, or A) and counts the 3 to the left of the duodecimal point in pi as 1, so the beginning is at 30763.
This takes 5 hours in Matlab, but I didn't have to write my own extended precision routines.
Edited on November 7, 2023, 7:06 am
|
Posted by Charlie
on 2023-11-07 07:02:43 |