Munchausen numbers: Difference between revisions
m
Pascal - fix tags and add an 'e' :-)
m (→{{header|Pascal}}: more explanation, hopefully no obfuscation ;-)) |
Walterpachl (talk | contribs) m (Pascal - fix tags and add an 'e' :-)) |
||
Line 294:
<pre>1
3435</pre>
=={{header|Pascal}}==
{{works with|Free Pascal}}
{{works with|Delphi}}
tried to speed things up.Only checking one arrangement of 123456789 instead of all 9! = 362880 permutations.
This ist possible, because summing up is commutative.So I only need to check, that the number and the sum of power of digits have the same amount in every possible digit. This means, that a permutation of the digits of number leads to the sum of power of digits.
<lang pascal>{$IFDEF FPC}{$MODE objFPC}{$ELSE}{$APPTYPE CONSOLE}{$ENDIF}
uses
|