On 20 Sep 98, at 16:40, Yehuda wrote:> Hello Logo friends,
>
> Logo is a great program to do arithmetics too - a fact that is sometimes
> overlooked. Last week, a friend asked me what were the last 2 digits of
> 2^999 (2 raised to the power of 999).Your friend might have been hoping that you wouldn't need a computer :)
Hello Tom and friends,
When my friend posed the problem for me, he knew for SURE, that I was going to solve it with the computer (probably in Excel).
A method of doing this on paper would be as follows:Nice analysis, and thanks for that algorithm.
Write down this table:n Last 2 digits of 2^n
========================
0 01
1 02
2 04
3 08
4 16
etc.Eventually, you will find a pair of last two digits (LTDs) which have
occurred in the table before. For example, the LTDs of 2^24 are 16, which
are also the LTDs of 2^4. So the LTDs of 2^25 will be 32, the LTDs of 2^26
will be 64 and so on. But we also know that the LTDs of 2^44 will be 16,
as will the LTDs of 2^64, 2^84, 2^104, etc. So you can look up the LTDs for
any 2^x by just counting on ((x-4) mod 20) places in the table starting
from 2^4.
The problem can easily be solved on paper only in the most trivial cases. It might be pretty complicated to find, e.g., the last 6 digits of 123^321.
I like you Logo implementation to the problem.
_/
_/ _/ _/_/_/_/_/ _/_/_/_/
_/
_/ _/_/ _/
_/
_/_/_/
_/ _/ _/ _/
_/ _/
_/_/_/_/ _/ _/
_/
_/_/ _/ _/ _/_/_/_/
http://www.geocities.com/CollegePark/lab/2276/
e-mail: yehuka@softhome.net
Global SchoolNet Foundation -
Linking Kids Around the World!
Copyright GSN - All Rights Reserved
- Comments
& Questions
Visit GSN's
Global
Schoolhouse for more exciting learning resources!
Search our Site
-
Home