Harshad or Niven series: Difference between revisions
Rename Perl 6 -> Raku, alphabetize, minor clean-up
m (→{{header|REXX}}: added some comments.) |
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
||
Line 113:
1002
</pre>
=={{header|Ada}}==
Line 280 ⟶ 279:
First Harshad number greater than 1000: 1002
</pre>
=={{header|BBC BASIC}}==
Line 508 ⟶ 506:
<pre>(1 2 3 4 5 6 7 8 9 10 12 18 20 21 24 27 30 36 40 42)
1002</pre>
=={{header|COBOL}}==
Line 1,253 ⟶ 1,248:
1002
</pre>
=={{header|Groovy}}==
Line 2,000 ⟶ 1,994:
<pre>1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, 21, 24, 27, 30, 36, 40, 42,
1002</pre>
=={{header|Pascal}}==
{{works with|Free Pascal}}
Line 2,168 ⟶ 2,163:
42
The first Harshad number greater than 1000 is 1002!</pre>
=={{header|Perl 6}}==▼
{{works with|Rakudo|2016.08}}▼
<lang perl6>constant @harshad = grep { $_ %% .comb.sum }, 1 .. *;▼
say @harshad[^20];▼
say @harshad.first: * > 1000;</lang>▼
{{out}}▼
<pre>(1 2 3 4 5 6 7 8 9 10 12 18 20 21 24 27 30 36 40 42)▼
1002</pre>▼
=={{header|Phix}}==
Line 2,493 ⟶ 2,477:
</pre>
=={{header|Python}}==
===Python: Procedural===
Line 2,726 ⟶ 2,711:
#19 40
#20 42
▲1002</pre>
(formerly Perl 6)
▲{{works with|Rakudo|2016.08}}
▲<lang perl6>constant @harshad = grep { $_ %% .comb.sum }, 1 .. *;
▲say @harshad[^20];
▲say @harshad.first: * > 1000;</lang>
▲{{out}}
▲<pre>(1 2 3 4 5 6 7 8 9 10 12 18 20 21 24 27 30 36 40 42)
1002</pre>
Line 2,948 ⟶ 2,945:
1002
</pre>
=={{header|Rust}}==
<lang Rust>
|