Factorions: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|Ring}}: Missing bases) |
m (→{{header|Pascal}}: added TIO.RUN until base 17. base 2still wrong) |
||
Line 790: | Line 790: | ||
modified [[munchhausen numbers#Pascal]]. |
modified [[munchhausen numbers#Pascal]]. |
||
output in base and 0! == 1!, so in Base 10 40585 has the same digits as 14558. |
output in base and 0! == 1!, so in Base 10 40585 has the same digits as 14558. |
||
<lang pascal> |
<lang pascal>program munchhausennumber; |
||
⚫ | |||
program munchhausennumber; |
|||
⚫ | |||
uses |
uses |
||
sysutils; |
sysutils; |
||
Line 798: | Line 797: | ||
tdigit = byte; |
tdigit = byte; |
||
const |
const |
||
MAXBASE = |
MAXBASE = 17; |
||
var |
var |
||
Line 837: | Line 836: | ||
For i := 2 to Base-1 do |
For i := 2 to Base-1 do |
||
result := result AND (dgtCnt[i]=0); |
result := result AND (dgtCnt[i]=0); |
||
result := result AND (dgtCnt[0]+dgtCnt[1]=0); |
|||
end; |
end; |
||
Line 896: | Line 897: | ||
begin |
begin |
||
cnt := 0; |
cnt := 0; |
||
For base := 2 to |
For base := 2 to MAXBASE do |
||
begin |
begin |
||
writeln('Base = ',base); |
writeln('Base = ',base); |
||
InitDgtPotDgt(base); |
InitDgtPotDgt(base); |
||
Munch(0,0,0,base |
Munch(0,0,0,base,base); |
||
end; |
end; |
||
writeln('Check Count ',cnt); |
writeln('Check Count ',cnt); |
||
Line 906: | Line 907: | ||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
TIO.RUN Real time: 45.701 s User time: 44.968 s Sys. time: 0.055 s CPU share: 98.51 % |
|||
Base = 2 |
Base = 2 |
||
1 1 1 |
1 1 1 |
||
Line 956: | Line 958: | ||
2 2 2 |
2 2 2 |
||
12973363226 8B0DD409C 11489BCDD |
12973363226 8B0DD409C 11489BCDD |
||
Base = 15 |
|||
⚫ | |||
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 |
|||
⚫ | |||
</pre> |
</pre> |
||