✔ 最佳答案
granzohk的兩個回答, 一個正確, 一個有待商確
有多少個零應該是對的
我用他的思路去找68!的第一位數, 發現有錯:
[begin of quote]
let Z = 68!
log 68 + ... + log 2 + log 1 大約等於 96.394457904928465986272471701547
所以, log Z = 96.394457904928465986272471701547
=> Z = 10 ^ 96.394457904928465986272471701547
第一位數字意思是什麼? 如果是 most significant digit 的話就應該是 1
[end of quote]
但小算盤(其實小算盤是很厲害的)告訴我們68! =
2.4800355424368305996009904185692e+96
換告話說, 第一個位是2
一般來說
從Z = 10 ^ X, 不能斷定 Z 的第一個位是1
反例: X = 2.4, Z = 10^2.4 = 251.2...
原因是不能忽略指數的小數點
其實, 如果是 least significant digit, 那就易找了!
a^b mod n = a^(b mod phi(n)) mod n
if a is relatively prime to n, where n is Euler's totient function
phi(10) = phi(2 * 5) = (2-1)(5-1) = 4
e.g. 2^5040 mod 10 = 2^(5040 mod 4) = 2^0 = 1
Every integer can be express as a product of a number of primes
We can first count the number of prime factors in {1, ..., 70}
64 (2^6), we have floor(70/64) = 1 factor
32 (2^5), we have floor(70/32) - 1 (otherwise double count 64) = 1 factor
16 (2^4), we have floor(70/16) - floor(70/32) = 2 factors.
8 (2^3), we have floor(70/8) - floor(70/16) = 4 factors.
similarly, we have 18 factors of 2, and 9 factors of 4
i.e. a maximum y that 70! is divisible by 2^y is
18*1 + 9*2 + 4*3 + 2*4 + 1*5 + 1*6 = 67
similarly, consider 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67...
3: 16
9: 5
27: 2
5: 12
25: 2
7: 9
49: 1
So the last digit of (70!)^5040 is
(2^67 * 3^32 * 5^16 * 7^11 * 11^6 * 13^5 * 17^4 * 19^3 * 23^3 * 29^2 * 31^2 * 37 * 41 * 43 * 47 * 53 * 59 * 61 * 67)^5040 mod 10
= (2^3 * 7^3 * 11^2 * 13 * 19^3 * 23^3 * 29^2 * 31^2 * 37 * 41 * 43 * 47 * 53 * 59 * 61 * 67) mod 10
= 78363605374422 mod 10
= 2
2007-04-02 14:37:08 補充:
雖然pf_kcmk_09112001已說誤會了但...既然你都說你的答案和我的一樣, 為什麼你會誤會呢? 不明白箇中的誤會我只想指出...我覺得他辨証方法有誤也許答案是 1, 但怎樣辨証呢?
2007-04-02 14:37:26 補充:
yup, 31^2 mod 10 can always be computed by (31 mod 10)^2just want to copy and paste the whole expression to the calculator, instead of simplifying (which may introduce typing error...ok... i admit i am lazy), anyway, windows' calculator is quite powerful =P