R is a
rational number such that 2
123456789 degrees Celsius is precisely equal to R degrees
Fahrenheit.
(I) Determine the first two digits (reading left to right) in [R].
(II) Determine the last two digits (reading left to right) in [R].
(III) Determine the first digit (reading left to right) following the decimal point in R.
Note: [x] denotes the greatest integer ≤ x.
print modpow(2,123456789,10000000000000000)
8355204473946112
determines that the last few digits of 2^123456789 are ...8355204473946112.
When divided by 5, only the first of these digits will be affected depending on the digits before.
So, when divided by 5, the number ends
...71040894789222.4
and then when multiplied by 9,
... 639368053103001.6
Then you add 32, making the ending ... 639368053103033.6
So part (II): 33
and Part (III): 6
More analytic solution:
2^n mod 1000 has a cycle of length 100 starting with 2^3:
8 16 32 64 128 256 512 24 48 96 192 384 768 536 72 144 288 576 152 304 608 216 432 864 728 456 912 824 648 296 592 184 368 736 472 944 888 776 552 104 208 416 832 664 328 656 312 624 248 496 992 984 968 936 872 744 488 976 952 904 808 616 232 464 928 856 712 424 848 696 392 784 568 136 272 544 88 176 352 704 408 816 632 264 528 56 112 224 448 896 792 584 168 336 672 344 688 376 752 504
so 2^123456789 mod 1000 is the same if taken mod 89, or for that matter, 189, which is 3*3*3*7, so you could cube, cube, cube and raise to the 7th. In any event, the power, mod 1000 is 112, so the last two digits after dividing by 5 are 22, with 2 left over, so the ending is ...22.4. Then multiplication by 9 gives ...01.6, with the addition of 32 then giving the same 33 and 6 as the answers to parts (II) and (III).
|
Posted by Charlie
on 2010-12-18 17:15:35 |