Searching \ for '[OT]: Maths again' in subject line. () Help us get a faster server
FAQ page: www.piclist.com/techref/method/math.htm?key=math
Search entire site for: 'Maths again'.

Exact match. Not showing close matches.
PICList Thread
'[OT]: Maths again'
2001\06\06@095604 by  Since you guys love maths so much:
Is there a way I can add up all the units in a number and then extract
the units from that later on?
ex:

17456=>
1+7+4+5+6=23
From 23 I want 17456 again.
Guess you would need a seed of some sort.

Quentin

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads  Hi Quentin -

Being married to a South African, I am sure you are not just pulling
our legs.

As any Cabbalist will tell you, the numbers 17456 and 23 are two sides of the same case.
You just need to use the math for other purposes than counting.

How does a topologist catch a lion in a cage in the desert ?
He defines the outside of the cage as the inside.

How does a theoretic mechanic engineer catch the lion ?
He disregards friction, and the mass attraction will get the lion into
the cage.

How does a particle physicist ....
He defines a uniform Lion Function over the entire desert and
integrates along the edge.

{Quote hidden}

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads  At 03:54 PM 6/6/01 +0200, Quentin wrote:
>Since you guys love maths so much:
>Is there a way I can add up all the units in a number and then extract
>the units from that later on?
>ex:
>
>17456=>
>1+7+4+5+6=23
> >From 23 I want 17456 again.
>Guess you would need a seed of some sort.

Can't be done, except to equivalence classes of numbers giving the same
hash total:

17456= 1+7+4+5+6 =23
71456 = 7+1+4+5+6 = 23
17654 = 1+7+6+5+4 = 23
etc.

As a rule, it would take the same number of bits to represent an 1:1
invertible transformed number as the number itself.

================================================================
Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: ral lcfltd.com
Least Cost Formulations, Ltd.            URL: http://lcfltd.com/
824 Timberlake Drive                     Tel: 757-467-0954
Virginia Beach, VA 23464-3239            Fax: 757-467-2947

"Vere scire est per causas scire"
================================================================

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads  > Since you guys love maths so much:
> Is there a way I can add up all the units in a number and then extract
> the units from that later on?
> ex:
>
> 17456=>
> 1+7+4+5+6=23
> From 23 I want 17456 again.
> Guess you would need a seed of some sort.
>
> Quentin

I don't see much chance of this being done by storing the sum of the digits
and nothing else.  Sorry.   However, if someone can "prove" me wrong, I will
never make a long winded post (preach) again.  ;oD   If you need complete
accuracy, the smallest way that I know of is to store your number in binary.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads  At 03:07 PM 6/6/01 -0500, michael brown wrote:
> > Since you guys love maths so much:
> > Is there a way I can add up all the units in a number and then extract
> > the units from that later on?
> > ex:
> >
> > 17456=>
> > 1+7+4+5+6=23
> > From 23 I want 17456 again.
> > Guess you would need a seed of some sort.
> >
> > Quentin
>
>I don't see much chance of this being done by storing the sum of the digits
>and nothing else.  Sorry.   However, if someone can "prove" me wrong, I will
>never make a long winded post (preach) again.  ;oD   If you need complete
>accuracy, the smallest way that I know of is to store your number in binary.

Simple proof:
04 => 0+4 = 4
22 => 2+2 = 4
31 => 3+1 = 4
40 => 4+0 = 4

No way to determine which input gave the output.
It's a poor one-way function though, because in some cases, you can get
back to the input.
If you're using it with large numbers though, then all you can determine is
a subset of the possible inputs.

--
Dave's Engineering Page: http://www.dvanhorn.org

I would have a link to http://www.findu.com/cgi-bin/find.cgi?KC6ETE-9 here
in my signature line, but due to the inability of sysadmins at TELOCITY to
differentiate a signature line from the text of an email, I am forbidden to
have it.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads  It reminds me of a compression scheme I heard of once that remove all the
zero's and keep the one's in a binary file... --Then you can just count the
remaining 1's and report how many!!!
:)

{Original Message removed}  Quentin wrote:

> Since you guys love maths so much:
> Is there a way I can add up all the units in a number and then
> extract the units from that later on? ex:
>
> 17456=>
> 1+7+4+5+6=23
> From 23 I want 17456 again.
> Guess you would need a seed of some sort.

Quentin:

As others have already shown, that particular method won't work.  If
you don't mind doing a little bit more math in the summing process,
though, you CAN get a sum from which your original number is
extractable.

Do it like this:

1.  Working right-to-left, multiply each digit by a succesive
power of 10, starting with 10**0 for the rightmost digit.

2.  Add up the products.  I'd probably do the addition from
to right, but you can do it either way.

For your example, the process works out to:

6 * 10**0 = 6 * 1 = 6
5 * 10**1 = 5 * 10 = 50
4 * 10**2 = 4 * 100 = 400
7 * 10**3 = 7 * 1000 = 7000
1 * 10**4 = 1 * 10000 = 10000

10000
7000
400
50
+     6
-------
17456

Extracting the original number from this sum is left as an exercise
for the reader.

-Andrew

=== Andrew Warren --- aiw cypress.com
=== IPD Systems Engineering, CYSD
=== Cypress Semiconductor Corporation
===
=== Opinions expressed above do not
=== necessarily represent those of
=== Cypress Semiconductor Corporation

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads  Michael Brown
Instant Net Solutions
http://www.KillerPCs.net

----- Original Message -----
From: "Dal Wheeler" <dwheeler INSIGHTEK.COM>
To: <PICLIST MITVMA.MIT.EDU>
Sent: Wednesday, June 06, 2001 4:02 PM
Subject: Re: [OT]: Maths again

> It reminds me of a compression scheme I heard of once that remove all the
> zero's and keep the one's in a binary file... --Then you can just count
the
{Quote hidden}

extract
{Quote hidden}

complete
> > >accuracy, the smallest way that I know of is to store your number in
> binary.
> >
> > Simple proof:
> > 04 => 0+4 = 4
> > 22 => 2+2 = 4
> > 31 => 3+1 = 4
> > 40 => 4+0 = 4
You forgot 13=> 1+3 =4
{Quote hidden}

here
> > in my signature line, but due to the inability of sysadmins at TELOCITY
to
{Quote hidden}

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads  > Is there a way I can add up all the units in a number and then extract
> the units from that later on?

If the numbers are arbitrary in base 10 then it can be shown that 17456 or
some palindrome of it is the minimal size required to store these distinct
numbers. If they are not in base 10 or not arbitrary then some other
schemes can be used.

Peter

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...