Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Newbie question

by oldB51 (Sexton)
on Aug 24, 2022 at 07:23 UTC ( [id://11146355]=note: print w/replies, xml ) Need Help??


in reply to Re: Newbie question
in thread Newbie question

Thank you AnomalousMonk. I think the point you are making is that when summing digits: if we consider integers of the form abc say then -abc will always sum to 2a less than abc. 2a is always even so abc and -abc must always both be odd or both even. Hence no need to worry about absolute values for this purpose. Please forgive me if I have not expressed this in a correct formal way - it is over 40 years since I did any mathematics. Your point is excellent.

Replies are listed 'Best First'.
Re^3: Newbie question
by AnomalousMonk (Archbishop) on Aug 24, 2022 at 16:10 UTC
    ... no need to worry about absolute values for this purpose.

    Yes, that's the point I was getting at. I also wanted to hint that you don't even need to be concerned with the numbers themselves, but only with the least-significant bit of each number (in 2s'-complement binary representation). The LS bit determines the odd/even status of a number, so adding up all these bits mod 2 (i.e., masking with 1) gives the answer.

    Please forgive me if I have not expressed this in a correct formal way ...

    No worries. I doubt if I would recognize a correct formal expression of this proposition if you hit me in the face with it.


    Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2024-04-18 11:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found