Magic numbers: Difference between revisions
→{{header|ALGOL 68}}: Avoid counting the single digit magic numbers twice
Thundergnat (talk | contribs) m (→{{header|ALGOL 68}}: total count is off) |
(→{{header|ALGOL 68}}: Avoid counting the single digit magic numbers twice) |
||
Line 36:
=={{header|ALGOL 68}}==
{{works with|ALGOL 68G|Any - tested with release 2.8.3.win32}}
Uses Algol 68G's LONG LONG INT, which has programmer definable
<syntaxhighlight lang="algol68">
BEGIN # count magic numbers: numbers divisible by the count of digits and #
Line 78 ⟶ 77:
# find the magic numbers #
print( ( "Magic number counts by number of digits:", newline ) );
INT m count :=
INT d count :=
FLEX[ 1 : 10 ]LONG LONG INT magic := ( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 );
FLEX[ 1 : 0 ]LONG LONG INT magic9;
Line 146 ⟶ 145:
24: 3
25: 1
Total:
Largest is 3608528850368400786036725
Minimally pandigital 1-9 magic numbers: 381654729
|