Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Finding sum of all digits from 1 to 1 million.

by runrig (Abbot)
on Jan 24, 2002 at 00:38 UTC ( [id://141017]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    for ($i=0; $i<1e6; $i++) {
    ...
    
  2. or download this
    my $total;
    for (1..1_000_000) {
     $total += $_ for split "";
    }
    print "$total\n";
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://141017]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2024-04-19 15:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found