Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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

by lhoward (Vicar)
on Jan 24, 2002 at 00:17 UTC ( #141010=note: print w/replies, xml ) Need Help??

in reply to Finding sum of all digits from 1 to 1 million.

With deference to jeffa and Ovid: you did not answer the right question. What vladb was asking for was "find the sum of all decimal digits appearing in the natural numbers from one to one million inclusive", not "find hte sum of all integers from 1 to one million inclusive".
  • Comment on Re: Finding sum of all digits from 1 to 1 million.

Replies are listed 'Best First'.
Re: Re: Finding sum of all digits from 1 to 1 million.
by little (Curate) on Jan 24, 2002 at 00:22 UTC
    mh, ok, repeat after me *grin*:

    Have a nice day
    All decision is left to your taste
    Uhm ok, seems I got you wrong here.
    so did you mean the solution would more look alike
    $ perl -e '$sum += length($_) for ( 1..1000000 );print $sum'
    But then I ask myself if that question is not much more tricky, cause there are only 10 decimal numbers we use to represent all numbers. So what is teh right answer though?
    the result of the above, as it is 5888896 or simply 10?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://141010]
[1nickt]: Wow. I had heard about the chips on HP cartriddges but not that issue. I rejected HP's equivalent laptop becuase of build quality, very plasticky keyboard. And I believe HP is the champon of bloatware, too.
[stevieb]: Perhaps my experience with HP is a bit different as I always bought the highest end models through business.
[Corion]: 1nickt: At least the machines that $work is introducing to replace the Lenovo T60 here do not inspire confidence with me

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (14)
As of 2017-03-27 13:29 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.