There is probably a joke in the comment that I am missing
but this post is going to give the design approaches to solving
the problem posed by FirstPerson in his signature:

find the last ten digits of
x^x (x raised to the power of x)
for all the positive 0dd numbers below 1000

1^1 + 3^3 + 5^5 ..... +997^997 + 999^999

The first thing to realise is that this is a
computationally small problem and the complete
answer can be found it just requires a ~million digits :)

If you only want the bottom 10 digits and only adding and multiplying

^x is like multiplying x times

you only care about the last 10 digits of any number you are using
temporary or otherwise

Some of you may not know why due to multiplication being taught
wrongly at school. It is easy enough for anyone
to do a 99-digit by 99-digit multiplication only writing down the
answer ;)

This is done the way that a computer can be used to find the exact answer

consider

12345678
x30978793

the answer can be found a digit at a time:

if you reverse one of the numbers
30978793 -> 39787903

then the last digit of the answer is:

12345678
|
39787903

is the last digit of 8 * 3 = 24

so a 4 then we have a 2 that we need to carry:
shift the numbers along by one to find next digit
carry - 2
12345678
||
39787903

and the next digit is the last of

2 + 7*3 + 8*9 = 95

5 and then there is a carry 9

shift the numbers along by one
carry - 9
12345678
|||
39787903
9 + 6*3 + 7*9 + 8*7 = 146
6 carry 14

keep going until the final digit
12345678
|
39787903

and you get the answer:
382454203206654

and as you can see the last 3 digits are as we thought
654

this shows that for multiplication it is only the last 10
digits that can affect the the last ten digits

Now back to the problem there are 3 approaches to consider:

1 - simple
2 - standard maths +
3 - bat out of hell


Using the above maths I am going to give a simple solution


We need a special class to keep track of the last 10 digits
and the minimal representation of it is as follows:

main shows the problem

#include "ten_digits.h"
#include <iostream>
int main()
{
	ten_digits sum(0, 0);
	for(int i(1); i < 1000; ++i)
	{
		if(i%2 == 1)
		{
			ten_digits self_power(0, i);
			self_power.raise_to_power(i - 1);//already had one power
			sum += self_power;
		}
	}
	
	std::cout << sum.get_display_string() << std::endl;
	return 0;
}

now in practice you would test ten_digits first
here is the .h

/*int cannot guarantee ten digits
this is a partial class
chopping top 5 & bottom 5
*/
#pragma once
#include <string> 

class ten_digits
{
public:
	ten_digits(int upper = 0, int lower = 0);
	ten_digits & operator+=(const ten_digits &td);
	void times_by(int small_int);
	bool raise_to_power(int pow);
	std::string  get_display_string() const;
	int get_ones() const {return ones;}
	int get_hundred_thousands() const {return hundred_thousands;}
private:
	int hundred_thousands, ones;
	const int i_100000;
};

this is needed as a 32 bit int is to small for 10 digits and a long
won't work directly for a*b%10000000000 without a potential overflow

Recommended Answers

All 7 Replies

Now the implementation of the the .cpp
completes the calculation although the display is messy
I have included it so people can use the code should they so wish

#include "ten_digits.h"

ten_digits::ten_digits(int upper, int lower)
:hundred_thousands(upper), ones(lower), i_100000(100000)
{
}

void ten_digits::times_by(int small_int)
{
	int temp = ones * small_int;
	ones = temp%i_100000; //bottom 5 digits
	int carry((temp - ones) / i_100000);//what are the overflow digits
	hundred_thousands = (hundred_thousands * small_int + carry) % i_100000;
}

ten_digits & ten_digits::operator +=(const ten_digits &td)
{
	ones += td.get_ones();
	hundred_thousands += td.get_hundred_thousands();
	if(ones > i_100000)
	{
		//have a carry of 1
		ones -= i_100000;
		++hundred_thousands;
	}
	hundred_thousands = hundred_thousands %i_100000;
	return *this;
}

std::string ten_digits::get_display_string() const
{
	std::string reverse_ret("");
	int half_digits(5);
	int current(ones);
	for(int i(0); i < half_digits; ++i)
	{
		int temp(current%10);
		char digit(temp);
		digit += '0';
		reverse_ret += digit;
		current /= 10;
	}
	current = hundred_thousands;
	for(int j(0); j < half_digits; ++j)
	{
		int temp(current%10);
		char digit(temp);
		digit += '0';
		reverse_ret += digit;
		current /= 10;
	}
	
	//need to reverse
	std::string ret;
	std::string::reverse_iterator r_it_stop(reverse_ret.rend());
	for(std::string::reverse_iterator r_it(reverse_ret.rbegin()); r_it != r_it_stop; ++r_it)
	{
		ret += *r_it;
	}
	return ret;
}

bool ten_digits::raise_to_power(int pow)
{
	bool ret(true);
	if(pow == 0)
	{
		hundred_thousands = 0;
		ones = 1;
	}
	else if(hundred_thousands == 0 && pow > 0)
	{
		int small_int(ones);
		for(int i(0); i < pow; ++i)
		{
			times_by(small_int);
		}
	}
	else
	{
		ret = false;
	}
	return ret;
}

Standard maths +

although you will not get a large improvement
for calculating serires

suppose you want to add some huge self powers and get the final 10 digits
say 124953276509676^124953276509676

then the ten_digits class even if extended will take a long time

there is a piece of mathematics called a polynomial expansion

for the trinomial

(A * x^2 + B * x + C)^m


you get C^m + m!/(0! * 1! * m - 1!) * B*x + C^m-1


The exact mathematics can be found easily the thing to note

is ABCD for a base ten number =
A*1000 + B*100 + C *10 + D
(10^3) (10^2)

and the
trinomial term

m!/((m-i-j)! *i! *j!) C^(m-i-j) * B^i * x^i * A^j *x^2j

needs only be found for
2j+i < 10
and for the bottom 10 digits as withthe simple example

now though powers to the modulo repeat

so for 3

3 9 7 1 3 9
0 2 2 0 0


the lower line is the carry

with this method you only need the 10 digit sequences
for the single digits

this can be reduced to a sequence that I won't go into
here

but a computational approach is there is an initial sequence
that will not repeat
and a stable cycle the stable cycle
as soon as a repeated sequence of 10 digits occurs you would
have the whole range

store this and then

3^x for x unsigned int
with a initial sequence of N

the if x < N

get initial_sequence3[x];

else

repeated_sequence3[((x-N) % repeated_sequence.size())];

these could be big I haven't checked


this then allows for much faster calculation

#3 = As fast as a bat out of hell

be warned such code stays angry for a long time and can bite:)

Only do this if you want to get PhD!

I have purposefully given only sketchy details

1. because I agree with WaltP's 3rd rule of procrastination
2. It gets messy
3. I am not sure if it could be used to break an existing cypher


You need specialist algorithms and your benchmark is method 2
and it gets left for dust the more randomly the selection of digits
from the power is wanted

This would be if you were trying to use a brute force decryption
for which there will be even stronger techniques

in base-10 3^100
looks messy but in base-3...

x^13 look at the last digit...

This means that the sum of powers is in fact not a random sequence

the nth digit can be found through extending what was touched on
about adding repeating sequences to convert the calculation of finding
the nth digit of any single digit number to any power in under 1000 FLOPs

If you want to look at the sums of powers

the interactions between the digits can be expressed as functions of the nth digit
equation and the modulo being used in the previous method can sum all of the occurences
of a particular digit.

The upshot of this is don't use powers as an encryption method if you are
a government agency!

There are encryption techniques that make RSA look like a caesar cypher but
in the modern age probably best not to publish them on an open forum

Sadly my instincts would always draw me to this approach :(

Yikes I only just realised that I had lost all of the formatting
for multiplication example :(

Should have looked more like:

12345678
x30978793

the answer can be found a digit at a time:

if you reverse one of the numbers
30978793 -> 39787903

then the last digit of the answer is:

1 2 3 4 5 6 7 8
              |
              3 9 7 8 7 9 0 3

is the last digit of 8 * 3 = 24

so a 4
then we have a 2 that we need to carry:
shift the numbers along by one to find next digit
carry = 2

1 2 3 4 5 6 7 8
            | |
            3 9 7 8 7 9 0 3

and the next digit is the last of

2 + 7*3 + 8*9 = 95

5
and then there is a carry 9

shift the numbers along by one
carry = 9

1 2 3 4 5 6 7 8
          | | |
          3 9 7 8 7 9 0 3

9 + 6*3 + 7*9 + 8*7 = 146

the point being that you just remember a 3-digit number at most
if you right down the answer a digit at a time
so:
9 + 18 = 27
27 + 63 = 90
90 + 56 = 14:6
6 carry 14

keep going until the final digit
(the carry works out as 0)

1 2 3 4 5 6 7 8		
              |
3 9 7 8 7 9 0 3

so the rirst digit is
0 + 1 * 3 = 3
and you get the answer:
382454203206654

and as you can see the last 3 digits are as we thought
654

I did not realise the whitespace formatting was so far off apologies to all.

I'm not sure what your answer, but here is what I believe is the answer :

1^1 % 10e10 = 1
3^3 % 10e10 = 27
5^5 % 10e10 = 3125
7^7 % 10e10 = 823543
9^9 % 10e10 = 387420489
11^11 % 10e10 = 85311670611
13^13 % 10e10 = 75106592253
15^15 % 10e10 = 90380859375
17^17 % 10e10 = 86336764177
19^19 % 10e10 = 13589123979
21^21 % 10e10 = 21381124421
23^23 % 10e10 = 55032910567
25^25 % 10e10 = 33447265625
27^27 % 10e10 = 19149892803
29^29 % 10e10 = 16126483469
31^31 % 10e10 = 56044734431
33^33 % 10e10 = 37183380513
35^35 % 10e10 = 96435546875
37^37 % 10e10 = 70199442517
39^39 % 10e10 = 17009951959
41^41 % 10e10 = 25137953641
43^43 % 10e10 = 67198995507
45^45 % 10e10 = 28173828125
47^47 % 10e10 = 96385062863
49^49 % 10e10 = 29325062449
51^51 % 10e10 = 8231315051
53^53 % 10e10 = 1256150373
55^55 % 10e10 = 99365234375
57^57 % 10e10 = 4855688057
59^59 % 10e10 = 99552427939
61^61 % 10e10 = 48560431661
63^63 % 10e10 = 79138342847
65^65 % 10e10 = 83837890625
67^67 % 10e10 = 50052277723
69^69 % 10e10 = 92201741429
71^71 % 10e10 = 65129996471
73^73 % 10e10 = 90062013833
75^75 % 10e10 = 83544921875
77^77 % 10e10 = 42530996797
79^79 % 10e10 = 51339775919
81^81 % 10e10 = 31371782481
83^83 % 10e10 = 47212640587
85^85 % 10e10 = 84814453125
87^87 % 10e10 = 18054601383
89^89 % 10e10 = 36592384409
91^91 % 10e10 = 29136642691
93^93 % 10e10 = 87336482893
95^95 % 10e10 = 33349609375
97^97 % 10e10 = 78485744737
99^99 % 10e10 = 59200499899
101^101 % 10e10 = 9200510101
103^103 % 10e10 = 7681176727
105^105 % 10e10 = 15478515625
107^107 % 10e10 = 24444217843
109^109 % 10e10 = 23710135389
111^111 % 10e10 = 99864397711
113^113 % 10e10 = 95285469553
115^115 % 10e10 = 33154296875
117^117 % 10e10 = 39751187877
119^119 % 10e10 = 12876383879
121^121 % 10e10 = 3628398521
123^123 % 10e10 = 40220839267
125^125 % 10e10 = 60205078125
127^127 % 10e10 = 72798431103
129^129 % 10e10 = 37361418369
131^131 % 10e10 = 8319685531
133^133 % 10e10 = 24633285813
135^135 % 10e10 = 67333984375
137^137 % 10e10 = 77801462217
139^139 % 10e10 = 7806491859
141^141 % 10e10 = 13454511741
143^143 % 10e10 = 74550116207
145^145 % 10e10 = 3369140625
147^147 % 10e10 = 21739665163
149^149 % 10e10 = 74857937349
151^151 % 10e10 = 35014210151
153^153 % 10e10 = 72286643673
155^155 % 10e10 = 20263671875
157^157 % 10e10 = 20201583757
159^159 % 10e10 = 22727167839
161^161 % 10e10 = 2215193761
163^163 % 10e10 = 60317095547
165^165 % 10e10 = 29345703125
167^167 % 10e10 = 89159464023
169^169 % 10e10 = 93864676329
171^171 % 10e10 = 98252955571
173^173 % 10e10 = 15254655133
175^175 % 10e10 = 76318359375
177^177 % 10e10 = 21071448497
179^179 % 10e10 = 66328035819
181^181 % 10e10 = 23400068581
183^183 % 10e10 = 98811465287
185^185 % 10e10 = 22509765625
187^187 % 10e10 = 70906491683
189^189 % 10e10 = 1423899309
191^191 % 10e10 = 73238185791
193^193 % 10e10 = 19064832193
195^195 % 10e10 = 19873046875
197^197 % 10e10 = 87005832437
199^199 % 10e10 = 27203999799
201^201 % 10e10 = 27204040201
203^203 % 10e10 = 17460513427
205^205 % 10e10 = 67236328125
207^207 % 10e10 = 46898532143
209^209 % 10e10 = 23395150289
211^211 % 10e10 = 33029444811
213^213 % 10e10 = 24515086853
215^215 % 10e10 = 35302734375
217^217 % 10e10 = 43890391577
219^219 % 10e10 = 25343243779
221^221 % 10e10 = 51055292621
223^223 % 10e10 = 54469127967
225^225 % 10e10 = 47900390625
227^227 % 10e10 = 82818489403
229^229 % 10e10 = 68551253269
231^231 % 10e10 = 88799556631
233^233 % 10e10 = 38201731113
235^235 % 10e10 = 6982421875
237^237 % 10e10 = 50853661917
239^239 % 10e10 = 51391231759
241^241 % 10e10 = 10559289841
243^243 % 10e10 = 11363796907
245^245 % 10e10 = 48876953125
247^247 % 10e10 = 18754387463
249^249 % 10e10 = 1570312249
251^251 % 10e10 = 49226625251
253^253 % 10e10 = 9863476973
255^255 % 10e10 = 19287109375
257^257 % 10e10 = 60395059457
259^259 % 10e10 = 91930707739
261^261 % 10e10 = 77898775861
263^263 % 10e10 = 25600608247
265^265 % 10e10 = 54541015625
267^267 % 10e10 = 67343370323
269^269 % 10e10 = 63163711229
271^271 % 10e10 = 17262034671
273^273 % 10e10 = 33181436433
275^275 % 10e10 = 56591796875
277^277 % 10e10 = 68528880197
279^279 % 10e10 = 75017695719
281^281 % 10e10 = 61129774681
283^283 % 10e10 = 13797249987
285^285 % 10e10 = 49267578125
287^287 % 10e10 = 23179701983
289^289 % 10e10 = 23580114209
291^291 % 10e10 = 96914448891
293^293 % 10e10 = 56275121493
295^295 % 10e10 = 3271484375
297^297 % 10e10 = 95584300137
299^299 % 10e10 = 30213499699
301^301 % 10e10 = 80213590301
303^303 % 10e10 = 38549010127
305^305 % 10e10 = 17431640625
307^307 % 10e10 = 12446766443
309^309 % 10e10 = 27725465189
311^311 % 10e10 = 93089811911
313^313 % 10e10 = 33734444153
315^315 % 10e10 = 43701171875
317^317 % 10e10 = 87101375277
319^319 % 10e10 = 41352703679
321^321 % 10e10 = 74024806721
323^323 % 10e10 = 58188776667
325^325 % 10e10 = 43408203125
327^327 % 10e10 = 86933067703
329^329 % 10e10 = 86138988169
331^331 % 10e10 = 53927347731
333^333 % 10e10 = 93627716413
335^335 % 10e10 = 62255859375
337^337 % 10e10 = 25063041617
339^339 % 10e10 = 78287171659
341^341 % 10e10 = 66975287941
343^343 % 10e10 = 29251037607
345^345 % 10e10 = 11572265625
347^347 % 10e10 = 89792229763
349^349 % 10e10 = 86065187149
351^351 % 10e10 = 27471560351
353^353 % 10e10 = 30525650273
355^355 % 10e10 = 43310546875
357^357 % 10e10 = 92503115157
359^359 % 10e10 = 25846047639
361^361 % 10e10 = 74294177961
363^363 % 10e10 = 45799880947
365^365 % 10e10 = 6298828125
367^367 % 10e10 = 91606996623
369^369 % 10e10 = 40861846129
371^371 % 10e10 = 82920233771
373^373 % 10e10 = 69181357733
375^375 % 10e10 = 71240234375
377^377 % 10e10 = 39330291897
379^379 % 10e10 = 84251755619
381^381 % 10e10 = 31403900781
383^383 % 10e10 = 18180994687
385^385 % 10e10 = 11962890625
387^387 % 10e10 = 14517232283
389^389 % 10e10 = 63984029109
391^391 % 10e10 = 81088431991
393^393 % 10e10 = 73106350793
395^395 % 10e10 = 30419921875
397^397 % 10e10 = 54008147837
399^399 % 10e10 = 95231999599
401^401 % 10e10 = 95232160401
403^403 % 10e10 = 16157666827
405^405 % 10e10 = 12939453125
407^407 % 10e10 = 29371920743
409^409 % 10e10 = 45784080089
411^411 % 10e10 = 69128499011
413^413 % 10e10 = 97882541453
415^415 % 10e10 = 5224609375
417^417 % 10e10 = 54531138977
419^419 % 10e10 = 52067763579
421^421 % 10e10 = 83699940821
423^423 % 10e10 = 27790785367
425^425 % 10e10 = 93603515625
427^427 % 10e10 = 26065166003
429^429 % 10e10 = 27367623069
431^431 % 10e10 = 20946058831
433^433 % 10e10 = 10650241713
435^435 % 10e10 = 80029296875
437^437 % 10e10 = 72936601317
439^439 % 10e10 = 79817311559
441^441 % 10e10 = 94025506041
443^443 % 10e10 = 15822838307
445^445 % 10e10 = 38330078125
447^447 % 10e10 = 20416192063
449^449 % 10e10 = 5745562049
451^451 % 10e10 = 47152015451
453^453 % 10e10 = 14812163573
455^455 % 10e10 = 39208984375
457^457 % 10e10 = 20392750857
459^459 % 10e10 = 23956187539
461^461 % 10e10 = 70884400061
463^463 % 10e10 = 87725913647
465^465 % 10e10 = 31494140625
467^467 % 10e10 = 72153342923
469^469 % 10e10 = 68522081029
471^471 % 10e10 = 56790552871
473^473 % 10e10 = 32593419033
475^475 % 10e10 = 67138671875
477^477 % 10e10 = 84702683597
479^479 % 10e10 = 61673215519
481^481 % 10e10 = 81865446881
483^483 % 10e10 = 33973699387
485^485 % 10e10 = 57470703125
487^487 % 10e10 = 47762082583
489^489 % 10e10 = 44358644009
491^491 % 10e10 = 67483135091
493^493 % 10e10 = 7697520093
495^495 % 10e10 = 48193359375
497^497 % 10e10 = 28864375537
499^499 % 10e10 = 50062499499
501^501 % 10e10 = 62750501
503^503 % 10e10 = 31497483527
505^505 % 10e10 = 634765625
507^507 % 10e10 = 69156995043
509^509 % 10e10 = 67453994989
511^511 % 10e10 = 31028506111
513^513 % 10e10 = 95898378753
515^515 % 10e10 = 66748046875
517^517 % 10e10 = 28126682677
519^519 % 10e10 = 49451423479
521^521 % 10e10 = 92043694921
523^523 % 10e10 = 55686154067
525^525 % 10e10 = 45361328125
527^527 % 10e10 = 44337784303
529^529 % 10e10 = 90280157969
531^531 % 10e10 = 67898689931
533^533 % 10e10 = 13008307013
535^535 % 10e10 = 7177734375
537^537 % 10e10 = 3781341017
539^539 % 10e10 = 8104651459
541^541 % 10e10 = 63832944141
543^543 % 10e10 = 94690199007
545^545 % 10e10 = 76025390625
547^547 % 10e10 = 79389274363
549^549 % 10e10 = 38814436949
551^551 % 10e10 = 86470990551
553^553 % 10e10 = 7262016873
555^555 % 10e10 = 53857421875
557^557 % 10e10 = 84730966557
559^559 % 10e10 = 66544127439
561^561 % 10e10 = 27952442161
563^563 % 10e10 = 14189706347
565^565 % 10e10 = 77001953125
567^567 % 10e10 = 22385409223
569^569 % 10e10 = 88507415929
571^571 % 10e10 = 1235991971
573^573 % 10e10 = 16756620333
575^575 % 10e10 = 91162109375
577^577 % 10e10 = 52673055297
579^579 % 10e10 = 35725075419
581^581 % 10e10 = 20957412981
583^583 % 10e10 = 79186364087
585^585 % 10e10 = 32666015625
587^587 % 10e10 = 88957252883
589^589 % 10e10 = 47226958909
591^591 % 10e10 = 58621558191
593^593 % 10e10 = 62187629393
595^595 % 10e10 = 3466796875
597^597 % 10e10 = 3539983237
599^599 % 10e10 = 23307999399
601^601 % 10e10 = 23308360601
603^603 % 10e10 = 1779460227
605^605 % 10e10 = 27392578125
607^607 % 10e10 = 66484989343
609^609 % 10e10 = 63418209889
611^611 % 10e10 = 29472833211
613^613 % 10e10 = 10720956053
615^615 % 10e10 = 75146484375
617^617 % 10e10 = 86635006377
619^619 % 10e10 = 26266683379
621^621 % 10e10 = 11819069021
623^623 % 10e10 = 50285882767
625^625 % 10e10 = 45556640625
627^627 % 10e10 = 89073922603
629^629 % 10e10 = 33719592869
631^631 % 10e10 = 33628241031
633^633 % 10e10 = 28440912313
635^635 % 10e10 = 90576171875
637^637 % 10e10 = 63704260717
639^639 % 10e10 = 76072191359
641^641 % 10e10 = 9320602241
643^643 % 10e10 = 25464119707
645^645 % 10e10 = 71533203125
647^647 % 10e10 = 18674476663
649^649 % 10e10 = 64274811849
651^651 % 10e10 = 24431485651
653^653 % 10e10 = 16414210173
655^655 % 10e10 = 34130859375
657^657 % 10e10 = 62984762257
659^659 % 10e10 = 14692867339
661^661 % 10e10 = 86581304261
663^663 % 10e10 = 84002259047
665^665 % 10e10 = 89697265625
667^667 % 10e10 = 58906195523
669^669 % 10e10 = 43980850829
671^671 % 10e10 = 79419551071
673^673 % 10e10 = 99009961633
675^675 % 10e10 = 90185546875
677^677 % 10e10 = 88068406997
679^679 % 10e10 = 95650335319
681^681 % 10e10 = 17922799081
683^683 % 10e10 = 67829988787
685^685 % 10e10 = 84423828125
687^687 % 10e10 = 67345743183
689^689 % 10e10 = 15911973809
691^691 % 10e10 = 17826701291
693^693 % 10e10 = 2715678693
695^695 % 10e10 = 43115234375
697^697 % 10e10 = 78221970937
699^699 % 10e10 = 44371499299
701^701 % 10e10 = 94371990701
703^703 % 10e10 = 80214596927
705^705 % 10e10 = 40087890625
707^707 % 10e10 = 19238903643
709^709 % 10e10 = 85159724789
711^711 % 10e10 = 95944480311
713^713 % 10e10 = 29289273353
715^715 % 10e10 = 77294921875
717^717 % 10e10 = 5603110077
719^719 % 10e10 = 76076543279
721^721 % 10e10 = 56589063121
723^723 % 10e10 = 36000971467
725^725 % 10e10 = 41064453125
727^727 % 10e10 = 10796580903
729^729 % 10e10 = 77328927769
731^731 % 10e10 = 17777712131
733^733 % 10e10 = 88687057613
735^735 % 10e10 = 77099609375
737^737 % 10e10 = 35612360417
739^739 % 10e10 = 57442931259
741^741 % 10e10 = 24211480341
743^743 % 10e10 = 3755600407
745^745 % 10e10 = 71728515625
747^747 % 10e10 = 73434798963
749^749 % 10e10 = 61929686749
751^751 % 10e10 = 40836500751
753^753 % 10e10 = 14807743473
755^755 % 10e10 = 26904296875
757^757 % 10e10 = 69421137957
759^759 % 10e10 = 10285407239
761^761 % 10e10 = 68653986361
763^763 % 10e10 = 51974571747
765^765 % 10e10 = 16455078125
767^767 % 10e10 = 1518701823
769^769 % 10e10 = 78905385729
771^771 % 10e10 = 55304230171
773^773 % 10e10 = 40692442933
775^775 % 10e10 = 11083984375
777^777 % 10e10 = 32515738697
779^779 % 10e10 = 91491995219
781^781 % 10e10 = 2804605181
783^783 % 10e10 = 9915573487
785^785 % 10e10 = 59619140625
787^787 % 10e10 = 75370553483
789^789 % 10e10 = 54536688709
791^791 % 10e10 = 69221564391
793^793 % 10e10 = 59420667993
795^795 % 10e10 = 14013671875
797^797 % 10e10 = 69897338637
799^799 % 10e10 = 43455999199
801^801 % 10e10 = 43456640801
803^803 % 10e10 = 56013893627
805^805 % 10e10 = 85595703125
807^807 % 10e10 = 88501737943
809^809 % 10e10 = 64961539689
811^811 % 10e10 = 42726447411
813^813 % 10e10 = 42542330653
815^815 % 10e10 = 20068359375
817^817 % 10e10 = 57377993777
819^819 % 10e10 = 93244003179
821^821 % 10e10 = 40716677221
823^823 % 10e10 = 53242420167
825^825 % 10e10 = 78759765625
827^827 % 10e10 = 63228759203
829^829 % 10e10 = 1551162669
831^831 % 10e10 = 80790103231
833^833 % 10e10 = 29485742913
835^835 % 10e10 = 13623046875
837^837 % 10e10 = 39212640117
839^839 % 10e10 = 86739871159
841^841 % 10e10 = 63028578441
843^843 % 10e10 = 61175641107
845^845 % 10e10 = 23486328125
847^847 % 10e10 = 62033241263
849^849 % 10e10 = 12382061649
851^851 % 10e10 = 16289035851
853^853 % 10e10 = 38981616773
855^855 % 10e10 = 79052734375
857^857 % 10e10 = 55107093657
859^859 % 10e10 = 76004747139
861^861 % 10e10 = 76853488461
863^863 % 10e10 = 68917644447
865^865 % 10e10 = 4150390625
867^867 % 10e10 = 73225928123
869^869 % 10e10 = 38044020629
871^871 % 10e10 = 93653029271
873^873 % 10e10 = 87143064233
875^875 % 10e10 = 732421875
877^877 % 10e10 = 24442050397
879^879 % 10e10 = 34093055119
881^881 % 10e10 = 66445831281
883^883 % 10e10 = 11454118187
885^885 % 10e10 = 5126953125
887^887 % 10e10 = 68674683783
889^889 % 10e10 = 28024103609
891^891 % 10e10 = 97729147491
893^893 % 10e10 = 26441597293
895^895 % 10e10 = 63037109375
897^897 % 10e10 = 12353086337
899^899 % 10e10 = 51564499099
901^901 % 10e10 = 1565310901
903^903 % 10e10 = 54388350327
905^905 % 10e10 = 10791015625
907^907 % 10e10 = 98556492243
909^909 % 10e10 = 15906654589
911^911 % 10e10 = 62901734511
913^913 % 10e10 = 45419127953
915^915 % 10e10 = 50341796875
917^917 % 10e10 = 11106657477
919^919 % 10e10 = 72932063079
921^921 % 10e10 = 79364911321
923^923 % 10e10 = 58421228867
925^925 % 10e10 = 5517578125
927^927 % 10e10 = 3293457503
929^929 % 10e10 = 47629297569
931^931 % 10e10 = 43908414331
933^933 % 10e10 = 90575968213
935^935 % 10e10 = 47021484375
937^937 % 10e10 = 31012099817
939^939 % 10e10 = 59286011059
941^941 % 10e10 = 41094896541
943^943 % 10e10 = 65335241807
945^945 % 10e10 = 73681640625
947^947 % 10e10 = 86032803563
949^949 % 10e10 = 97034936549
951^951 % 10e10 = 32192090951
953^953 % 10e10 = 89474830073
955^955 % 10e10 = 37451171875
957^957 % 10e10 = 7909629357
959^959 % 10e10 = 15333887039
961^961 % 10e10 = 94662810561
963^963 % 10e10 = 81642477147
965^965 % 10e10 = 99658203125
967^967 % 10e10 = 230874423
969^969 % 10e10 = 66959755529
971^971 % 10e10 = 60028948371
973^973 % 10e10 = 67700825533
975^975 % 10e10 = 6005859375
977^977 % 10e10 = 99074342097
979^979 % 10e10 = 95096515019
981^981 % 10e10 = 60489477381
983^983 % 10e10 = 74456622887
985^985 % 10e10 = 67822265625
987^987 % 10e10 = 66101134083
989^989 % 10e10 = 62097218509
991^991 % 10e10 = 49072450591
993^993 % 10e10 = 61917466593
995^995 % 10e10 = 37060546875
997^997 % 10e10 = 56176214037
999^999 % 10e10 = 499998999

Total Sum is = 24329559449000

I'm not sure what your answer, but here is what I believe is the answer :
Total Sum is = 24329559449000

My code I included only works out the bottom 10 digits so
9559449000
Guess you probably didn't need any help after all :)

I don't know if you wanted a broader approach to say calculating...

the last 128 digits from the sum of 1000 numbers to a random power I can go through method two if it will help.

I would recommend a computing approach over the mathematical sequences as it is difficult to format maths without paper and pencil.

My code I included only works out the bottom 10 digits so
9559449000
Guess you probably didn't need any help after all :)

I don't know if you wanted a broader approach to say calculating...

the last 128 digits from the sum of 1000 numbers to a random power I can go through method two if it will help.

I would recommend a computing approach over the mathematical sequences as it is difficult to format maths without paper and pencil.

My signature is an exercise for the people willing to give it a try.
I just write it in a weird way. Anyway, nice job for the solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.