Re: How to calculate/process this one?
Re: How to calculate/process this one?
- Subject: Re: How to calculate/process this one?
- From: Arthur J Knapp <email@hidden>
- Date: Sat, 27 Apr 2002 16:21:05 -0400
>
Date: Sat, 27 Apr 2002 10:00:54 -0700
>
Subject: Re: How to calculate/process this one?
>
From: Paul Berkowitz <email@hidden>
>
>> Let's say I have a random number like 11050. Now I want to add each pair
>
>> of consecutive digits to give the next line (so 11050 becomes 2155). I
>
>> want to repeat this step until I have a two-digit number.
>
On 4/27/02 9:42 AM, "Arthur J Knapp" <email@hidden> wrote:
>
> I don't understand, how does 11050 become 2155 ???
>
He's adding every single (overlapping) adjacent pair.
>
1 + 1 = 2 -- digits 1 and 2
>
1 + 0 = 1 -- digits 2 and 3
>
0 + 5 = 5
>
5 + 0 = 5
Ah ha.
>
The only reason he number of digits is reduced is because of all those 0 and
>
1 digits keeps the individual sums less than 10. if he's started out with
>
>
99599
>
>
9 + 9 = 18
>
9 + 5 = 14
>
5 + 9 = 14
>
9 + 5 = 18
>
>
we now have an 8-digit number 18141418.
I wanted to see what would happen if we continued the process,
using the sums:
>
99599
>
>
9 + 9 = 18
>
9 + 5 = 14
>
5 + 9 = 14
>
9 + 5 = 18
18 + 14 --> 32
14 + 14 --> 28
14 + 18 --> 32
32 + 28 --> 60
28 + 32 --> 60
60 + 60 --> 120 ??? Start over again ???
1 + 2 --> 3
2 + 0 --> 2
32
Darn, I was hoping it would be the answer to life, the universe,
and everything. ;-)
>
The next number would be 9955559. Then you'd get 181410101014. Then
>
9955111115. Then 181410622226. I don't think it's ever going to reduce to 1
>
digit, although I wouldn't like to have to prove that.
If the original poster wants to simply be able to take any given number
and use it to obtain a 2 digit number, he could simply use modulo math
with (n mod 90 + 10). This should always return a 2 digit number:
set x to 11050
x mod 90 + 10 --> 80
set x to 99599
x mod 90 + 10 --> 69
{ Arthur J. Knapp, of <
http://www.STELLARViSIONs.com>
<
mailto:email@hidden>
try
<
http://www.seanet.com/~jonpugh/>
on error number -128
end try
}
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.