Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

what is the final digit in the number 947^362?

Status
Not open for further replies.

giogiogio

Newbie level 1
Joined
Sep 9, 2009
Messages
0
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,280
Location
philippines
Activity points
1,308
what is the final digit in the number 947^362? can u help me to figure this out I need the complete solution.
 

947^362 =
2745948571821074460117767511934525623726695390994942893853121271175569
2465869164672059839447465232567749040956518321177110373301273250840811
2833576548938705845289303982469204071419423154726009794296598262151457
5805255298107990324477012167443353221465694707732964724055931317413352
3977508874048568177249527388724549428189316385068306627993235825384643
4605166354084510840993960693590363260534637008247370877455431219927028
7283747300637937030356081548764186164018595629421251358385328366972959
0539430090502856908734081505205753287618596176092620740657108667904131
9427776263400061760544306892710725961320778167789296982889630303774891
6652019897911955604736755415063659485033743677683180319734067055832775
2653895793616047835799553253094320821137730305771270108974068452324697
9477551329540959272832636540241228987837401618443156268443740181839551
3207763680744362876615481314073479406202673595802383950198315275514118
5146286408155598211350956077591863372420988162173276760508144457086752
3698644910324530570673654179761746935303832222176370690187576004103826
1230290077981863656261873609

so you have your last digit ...
 

OK, here're your homeworks:
you can use the proggi below to calculate the last digit.
The trick is this: if you just wanted to know the last digit, your calculation can also be reduced to the last digit. So we won't calculate 947^362, but 7^362.
Calculating the power means multiplying the basis with itself exponent times.
So the sequence would be:
7^1 = 7
7^2 = 49
7^3 = 343
7^4 = 2401
7^5 = 16807
7^6 = 117649
.
.
.
7^362 = a very big number

As that very big number (requires special libraries) is not interesting we can again reduce the result of each multiplication to the last digit.
So the sequence is like that (compare to the last digit of sequence above):
1 * 7 = 7 --> 7
7 * 7 = 49 --> 9
9 * 7 = 63 --> 3
3 * 7 = 21 --> 1
1 * 7 = 7 --> 7
7 * 7 = 49 --> 9
.... (repeat 362 times in total) --> Result: 9

Btw. you'll recognize that the sequence of the last digit is always: 7 9 3 1
So you can also calculate 362 / 4 = 90.5. The result after 0.5 of this sequence is 9

Code:
void main(void)
{
	unsigned int basis;
	unsigned int exponent;
	unsigned char lastdigit;
	unsigned int counter;


	basis = 947;
	exponent = 362;
	printf("\nCalculating the last digit of: %d^%d\n", basis, exponent);
	basis = lastdigit = basis % 10;											// reduce to last digit, e.g. 947 --> 7
	for(counter = 2; counter <= exponent; counter++)
	{
		lastdigit = lastdigit * basis;
		lastdigit = lastdigit % 10;											// reduce result to last digit
//		printf("\nExponent: %d  Last Digit: %d", counter, lastdigit);
//		getch();
	}
	printf("\n\nResult: %d\n", lastdigit);
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top