1000! mod 10^250
===============
the answer is 2
================
Hi I'm trying to solve the above problem that was asked recently. Couldn't mod it because it was closed.
So far I've found the 1000! has 249 zeros
because there are
200 multiples of 5 that will generate 200 zeros
40 multiples of 25 that will generate an Additional 40 zeros
8 multiples of 125 that will generate an Additional 8 zeros
1 multiple of 625 that will generate an addition zero.
So what I'm trying to find is what the last significant digit is.
Now.
1x2x3x4x1x6x7x8x9
generates a value that ends in 6
The same will apply to every other sequence ending in
1,2,3,4,6,7,8,9
of which there are 100
6^100 conveniently also ends in 6 as does any power of 6.
Multiplying of 10, 20,30,40, 60,70,80,90 will does the same thing for every set of 100
as will
the multiplying of 100, 200,300,400, 600,700,800,900 will does the same thing as well.
However, I can't figure out how to deal with the multiples of 5 now that are not multiples of 10 and the multipliers that are multiples of 50 that aren't 100s
and the 500.
Any suggestions ?
So far I've found the 1000! has 249 zeros
because there are
200 multiples of 5 that will generate 200 zeros
40 multiples of 25 that will generate an Additional 40 zeros
8 multiples of 125 that will generate an Additional 8 zeros
1 multiple of 625 that will generate an addition zero.
So what I'm trying to find is what the last significant digit is.
Now.
1x2x3x4x1x6x7x8x9
generates a value that ends in 6
The same will apply to every other sequence ending in
1,2,3,4,6,7,8,9
of which there are 100
6^100 conveniently also ends in 6 as does any power of 6.
Multiplying of 10, 20,30,40, 60,70,80,90 will does the same thing for every set of 100
as will
the multiplying of 100, 200,300,400, 600,700,800,900 will does the same thing as well.
However, I can't figure out how to deal with the multiples of 5 now that are not multiples of 10 and the multipliers that are multiples of 50 that aren't 100s
and the 500.
Any suggestions ?
Update: Actually, I just realised that I can bind every 5 to a 2; every 50 to a 20, and the 500 to a 200
Leaving me with 111 sets of (1.3.4.6.7.8.9)
which ends in an 8
so 8^111 ends in a 2; because powers of 8 mod 10 repeat in sets of 4.
So I'm guessing that the final answer is 2
Anybody know if this would be correct ?
Thanks.
Leaving me with 111 sets of (1.3.4.6.7.8.9)
which ends in an 8
so 8^111 ends in a 2; because powers of 8 mod 10 repeat in sets of 4.
So I'm guessing that the final answer is 2
Anybody know if this would be correct ?
Thanks.
Update 2: Thanks for the "can't bind the 5s" Forgot that that's kind of why they were left out to begin with.
The 111 was from
100 sequences of 1,2,3,...,9; 10 sequences of 10,20,30...,90; 1 sequence of 100,200,300...
thanks for the Wolfram link - that's awesome.
The 111 was from
100 sequences of 1,2,3,...,9; 10 sequences of 10,20,30...,90; 1 sequence of 100,200,300...
thanks for the Wolfram link - that's awesome.
Update 3: Primes seem to have been the way to go.
1000! can be written as
2^994.3^498.5^249.7^164.11^98.13^81.17^... etc
which can written
2^249.5^249.2^745.3^498. etc
1000! can then also be thought of as Product(all non multiples of 5).5^160.Product(allnon multiples of 5 to 200).(5^2)^(40-8).Product(all non multiples of 5 to 40).(5^3)^(8-1)(Pupto8).(5^4)^1(1)
which is 5^249.(product sequences with all least significant digits 1,2,3,4,6,7,8,9).product_sequence(1.2.3....
which is 5^249(sequence ending in 6)(sequence ending in 4)
which is 5^249(sequence ending in 4)
I already know that the (sequence ending in 4) has 2^249.2^745 as a factor.
Taking out 2^249 from that (sequence ending in 4) will remove the issue with the 5s
multiples of 2 end in the sequence 2,4,8,6, 2,4,8,6 etc.
stepping back 249 times along this sequence starting at 4, we arrive at 2
So I think that is a reasonable method and answer ?
Thanks for all the help.
1000! can be written as
2^994.3^498.5^249.7^164.11^98.13^81.17^... etc
which can written
2^249.5^249.2^745.3^498. etc
1000! can then also be thought of as Product(all non multiples of 5).5^160.Product(allnon multiples of 5 to 200).(5^2)^(40-8).Product(all non multiples of 5 to 40).(5^3)^(8-1)(Pupto8).(5^4)^1(1)
which is 5^249.(product sequences with all least significant digits 1,2,3,4,6,7,8,9).product_sequence(1.2.3....
which is 5^249(sequence ending in 6)(sequence ending in 4)
which is 5^249(sequence ending in 4)
I already know that the (sequence ending in 4) has 2^249.2^745 as a factor.
Taking out 2^249 from that (sequence ending in 4) will remove the issue with the 5s
multiples of 2 end in the sequence 2,4,8,6, 2,4,8,6 etc.
stepping back 249 times along this sequence starting at 4, we arrive at 2
So I think that is a reasonable method and answer ?
Thanks for all the help.
========================================================================================
Best Answer: Yes, it ends in 249 0's and the last significant digits are 10970027753472. I have a program that does the calculation. Results are in the image below, or athttp://i276.photobucket.com/albums/kk2/f... if YahooAnswers maintenance is preventing you from seeing it.
I'm not quite sure of the details of what you did. You can't ignore the multiples of 5 just because they get matched up with a 2. E.g., take 30 and 40. Match up the 5's and you are left with factors of 6 and 8, which are different, and you have to account for those quotients after the 5's are out. You are looking at sets of 1x3x4x6x7x8x9 but when you take the 2 out to bind to a 5, what's left? 32x35 = 1120. 42*45 = 1890. So in one case you still have a 2 to deal with, in the other it's a 9.
1*2*3*4*6*7*8*9*(5*10) = 72,576 x 50 = something ending in 6 x 50 = 3628800. Last s.d. is an 8.
The product from 11 to 20 = something ending in 6 x (15x20) = something ending in 6 x 300. Last s.d. is again an 8
But the product from, say, 31 to 40 = something ending in 6 x (35*40) = 6 x 1400 and it ends in a 4, not an 8.
So you've matched up all the 5's, but you need to be concerned about what's left when you do that. I'm not quite sure if you've done that. 2 is the right answer, but I'm not sure that it's because 8^111 ends in 2. Maybe it is, but I don't see where you got 111. Is that from factoring out the 5's somehow?
I think you have either figured out the right answer, or are on the right track. It looks like you may have a little more work to do to solve this analytically.
Here's some add'l info, a table of the last 3 s.d.'s of n!
100 864
200 472
300 496
400 008
500 864
600 496
700 384
800 496
900 432
1000 472
You can see how irregular it is. It's easy to count the factors of 5, but not so easy to determine that last digit of what you are left with after you factor them out.
Another approach is to count all the prime factors of 1000!, toss out the 5's and 249 of the 2's, find p^e mod 1000, and then take the cumulative product mod 1000. Once again you get 472 as the last 3 s.d.'s. You get:
P e p^e mod 1000 *** prod mod 1000
2 745 832 832
3 498 889 648
5 0 1 648
7 164 401 848
11 98 281 288
13 81 613 544
17 61 617 648
19 54 321 8
23 44 241 928
29 35 549 472
31 33 191 152
37 27 533 16
41 24 561 976
43 23 507 832
47 21 847 704
53 18 689 56
59 16 41 296
61 16 961 456
67 14 329 24
71 14 881 144
73 13 33 752
79 12 441 632
83 12 161 752
89 11 489 728
97 10 49 672
101 9 901 472
103 9 583 176
107 9 507 232
109 9 389 248
113 8 321 608
127 7 503 824
131 7 811 264
137 7 433 312
139 7 379 248
149 6 601 48
151 6 401 248
157 6 449 352
163 6 9 168
167 5 607 976
173 5 93 768
179 5 899 432
181 5 901 232
191 5 951 632
193 5 193 976
197 5 757 832
199 5 999 168
211 4 441 88
223 4 441 808
227 4 841 528
229 4 481 968
233 4 521 328
239 4 641 248
241 4 561 128
251 3 251 128
257 3 593 904
263 3 447 88
269 3 109 592
271 3 511 512
277 3 933 696
281 3 41 536
283 3 187 232
293 3 757 624
307 3 443 432
311 3 231 792
313 3 297 224
317 3 13 912
331 3 691 192
337 2 569 248
347 2 409 432
349 2 801 32
353 2 609 488
359 2 881 928
367 2 689 392
373 2 129 568
379 2 641 88
383 2 689 632
389 2 321 872
397 2 609 48
401 2 801 448
409 2 281 888
419 2 561 168
421 2 241 488
431 2 761 368
433 2 489 952
439 2 721 392
443 2 249 608
449 2 601 408
457 2 849 392
461 2 521 232
463 2 369 608
467 2 89 112
479 2 441 392
487 2 169 248
491 2 81 88
499 2 1 88
503 1 503 264
509 1 509 376
521 1 521 896
523 1 523 608
541 1 541 928
547 1 547 616
557 1 557 112
563 1 563 56
569 1 569 864
571 1 571 344
577 1 577 488
587 1 587 456
593 1 593 408
599 1 599 392
601 1 601 592
607 1 607 344
613 1 613 872
617 1 617 24
619 1 619 856
631 1 631 136
641 1 641 176
643 1 643 168
647 1 647 696
653 1 653 488
659 1 659 592
661 1 661 312
673 1 673 976
677 1 677 752
683 1 683 616
691 1 691 656
701 1 701 856
709 1 709 904
719 1 719 976
727 1 727 552
733 1 733 616
739 1 739 224
743 1 743 432
751 1 751 432
757 1 757 24
761 1 761 264
769 1 769 16
773 1 773 368
787 1 787 616
797 1 797 952
809 1 809 168
811 1 811 248
821 1 821 608
823 1 823 384
827 1 827 568
829 1 829 872
839 1 839 608
853 1 853 624
857 1 857 768
859 1 859 712
863 1 863 456
877 1 877 912
881 1 881 472
883 1 883 776
887 1 887 312
907 1 907 984
911 1 911 424
919 1 919 656
929 1 929 424
937 1 937 288
941 1 941 8
947 1 947 576
953 1 953 928
967 1 967 376
971 1 971 96
977 1 977 792
983 1 983 536
991 1 991 176
997 1 997 472
I'm not quite sure of the details of what you did. You can't ignore the multiples of 5 just because they get matched up with a 2. E.g., take 30 and 40. Match up the 5's and you are left with factors of 6 and 8, which are different, and you have to account for those quotients after the 5's are out. You are looking at sets of 1x3x4x6x7x8x9 but when you take the 2 out to bind to a 5, what's left? 32x35 = 1120. 42*45 = 1890. So in one case you still have a 2 to deal with, in the other it's a 9.
1*2*3*4*6*7*8*9*(5*10) = 72,576 x 50 = something ending in 6 x 50 = 3628800. Last s.d. is an 8.
The product from 11 to 20 = something ending in 6 x (15x20) = something ending in 6 x 300. Last s.d. is again an 8
But the product from, say, 31 to 40 = something ending in 6 x (35*40) = 6 x 1400 and it ends in a 4, not an 8.
So you've matched up all the 5's, but you need to be concerned about what's left when you do that. I'm not quite sure if you've done that. 2 is the right answer, but I'm not sure that it's because 8^111 ends in 2. Maybe it is, but I don't see where you got 111. Is that from factoring out the 5's somehow?
I think you have either figured out the right answer, or are on the right track. It looks like you may have a little more work to do to solve this analytically.
Here's some add'l info, a table of the last 3 s.d.'s of n!
100 864
200 472
300 496
400 008
500 864
600 496
700 384
800 496
900 432
1000 472
You can see how irregular it is. It's easy to count the factors of 5, but not so easy to determine that last digit of what you are left with after you factor them out.
Another approach is to count all the prime factors of 1000!, toss out the 5's and 249 of the 2's, find p^e mod 1000, and then take the cumulative product mod 1000. Once again you get 472 as the last 3 s.d.'s. You get:
P e p^e mod 1000 *** prod mod 1000
2 745 832 832
3 498 889 648
5 0 1 648
7 164 401 848
11 98 281 288
13 81 613 544
17 61 617 648
19 54 321 8
23 44 241 928
29 35 549 472
31 33 191 152
37 27 533 16
41 24 561 976
43 23 507 832
47 21 847 704
53 18 689 56
59 16 41 296
61 16 961 456
67 14 329 24
71 14 881 144
73 13 33 752
79 12 441 632
83 12 161 752
89 11 489 728
97 10 49 672
101 9 901 472
103 9 583 176
107 9 507 232
109 9 389 248
113 8 321 608
127 7 503 824
131 7 811 264
137 7 433 312
139 7 379 248
149 6 601 48
151 6 401 248
157 6 449 352
163 6 9 168
167 5 607 976
173 5 93 768
179 5 899 432
181 5 901 232
191 5 951 632
193 5 193 976
197 5 757 832
199 5 999 168
211 4 441 88
223 4 441 808
227 4 841 528
229 4 481 968
233 4 521 328
239 4 641 248
241 4 561 128
251 3 251 128
257 3 593 904
263 3 447 88
269 3 109 592
271 3 511 512
277 3 933 696
281 3 41 536
283 3 187 232
293 3 757 624
307 3 443 432
311 3 231 792
313 3 297 224
317 3 13 912
331 3 691 192
337 2 569 248
347 2 409 432
349 2 801 32
353 2 609 488
359 2 881 928
367 2 689 392
373 2 129 568
379 2 641 88
383 2 689 632
389 2 321 872
397 2 609 48
401 2 801 448
409 2 281 888
419 2 561 168
421 2 241 488
431 2 761 368
433 2 489 952
439 2 721 392
443 2 249 608
449 2 601 408
457 2 849 392
461 2 521 232
463 2 369 608
467 2 89 112
479 2 441 392
487 2 169 248
491 2 81 88
499 2 1 88
503 1 503 264
509 1 509 376
521 1 521 896
523 1 523 608
541 1 541 928
547 1 547 616
557 1 557 112
563 1 563 56
569 1 569 864
571 1 571 344
577 1 577 488
587 1 587 456
593 1 593 408
599 1 599 392
601 1 601 592
607 1 607 344
613 1 613 872
617 1 617 24
619 1 619 856
631 1 631 136
641 1 641 176
643 1 643 168
647 1 647 696
653 1 653 488
659 1 659 592
661 1 661 312
673 1 673 976
677 1 677 752
683 1 683 616
691 1 691 656
701 1 701 856
709 1 709 904
719 1 719 976
727 1 727 552
733 1 733 616
739 1 739 224
743 1 743 432
751 1 751 432
757 1 757 24
761 1 761 264
769 1 769 16
773 1 773 368
787 1 787 616
797 1 797 952
809 1 809 168
811 1 811 248
821 1 821 608
823 1 823 384
827 1 827 568
829 1 829 872
839 1 839 608
853 1 853 624
857 1 857 768
859 1 859 712
863 1 863 456
877 1 877 912
881 1 881 472
883 1 883 776
887 1 887 312
907 1 907 984
911 1 911 424
919 1 919 656
929 1 929 424
937 1 937 288
941 1 941 8
947 1 947 576
953 1 953 928
967 1 967 376
971 1 971 96
977 1 977 792
983 1 983 536
991 1 991 176
997 1 997 472
Source(s):http://www.wolframalpha.com/input/?i=100... gives you the answer too. Keep asking for "more digits."