Factorions: Difference between revisions

m
→‎{{header|Pascal}}: added TIO.RUN until base 17. base 2still wrong
m (→‎{{header|Ring}}: Missing bases)
m (→‎{{header|Pascal}}: added TIO.RUN until base 17. base 2still wrong)
Line 790:
modified [[munchhausen numbers#Pascal]].
output in base and 0! == 1!, so in Base 10 40585 has the same digits as 14558.
<lang pascal>program munchhausennumber;
{$IFDEF FPC}{$MODE objFPC}{$Optimization,On,all}{$ELSE}{$APPTYPE CONSOLE}{$ENDIF}
program munchhausennumber;
{$IFDEF FPC}{$MODE objFPC}{$ELSE}{$APPTYPE CONSOLE}{$ENDIF}
uses
sysutils;
Line 798 ⟶ 797:
tdigit = byte;
const
MAXBASE = 1417;
 
var
Line 837 ⟶ 836:
For i := 2 to Base-1 do
result := result AND (dgtCnt[i]=0);
result := result AND (dgtCnt[0]+dgtCnt[1]=0);
 
end;
 
Line 896 ⟶ 897:
begin
cnt := 0;
For base := 2 to 14MAXBASE do
begin
writeln('Base = ',base);
InitDgtPotDgt(base);
Munch(0,0,0,base-1,base);
end;
writeln('Check Count ',cnt);
Line 906 ⟶ 907:
{{out}}
<pre>
TIO.RUN Real time: 45.701 s User time: 44.968 s Sys. time: 0.055 s CPU share: 98.51 %
Base = 2
1 1 1
Line 956 ⟶ 958:
2 2 2
12973363226 8B0DD409C 11489BCDD
Base = 15
Check Count 13027729
1 1 1
2 2 2
1441 661 166
1442 662 266
Base = 16
1 1 1
2 2 2
2615428934649 260F3B66BF9 1236669BBFF
Base = 17
1 1 1
2 2 2
40465 8405 1458
43153254185213 146F2G8500G4 111244568FGG
43153254226251 146F2G8586G4 124456688FGG
Check Count 130277291571990934
</pre>
 
Anonymous user