数学中国

用户名  找回密码
 注册
帖子
热搜: 活动 交友 discuz
查看: 1196|回复: 4

求阶乘的最后一位非 0 的数字

[复制链接]
发表于 2025-1-6 15:06 | 显示全部楼层 |阅读模式
2025!的最后一个非0数字
计G(n) 表示 n的 最后一个非0数字 其中要求n>2
G(1) =1是唯一 的奇数 讨论无意义
我们可以看成 G(1)=6
##### 1 明显是 2 4 8 6 其中一个 不会是 奇数
证明 2025=a2b5c(a25)
明显 b远远大于c  所以 最后 一定是偶数
##### 2 任意数 *6 或 *1 末尾不变
##### 循环
故意写 {2 4 8 6 }没有写{2 4 6 8} 是这样 能生成一个循环
2*2=4
4*2=8
8*2=6
6*2=1
*2  就是 这个序列 往后移动 一   位
*3  就是 这个序列 往后移动 三   位
*4  就是 这个序列 往后移动 二   位
且 每4次一个循环
Gnz4=G(n)
Gnk=G(n(k+5))k{1,2,3,4}  

##### 单独分析 5   
G(n*5)=G(n*5*6) =G(n*30) =G(n*3)
##### 进制转换
(2025)10=(31100)5

表示 就有5的指数 =405 +81 +16+3=505 mod 4=1
有 405 个 原始的1234 组合  
无剩下
有 81 个  5的一次 的1234 组合  lg(5 ,10,15,20) (30,35,40,45)
无剩下
有 16 个  5的二次 的1234 组合  lg(25 ,50,75,100)
剩下1  不会改变末尾数字
有 3 个  5的3次 的1234 组合  lg(125 ,250,375,500)
剩下 1 *1 不会改变末尾数字
最后剩下3个  625 *{1,2,3}    *1*2*3 =*6不会改变末尾数字
也就是 1234的组合有 405+81+16+3 =505个  mod 4=1

G(N*1*2*3*4)=G(n*4)
6*4*3=72
###  所以  2025!的最后一个非0数字是 2
 楼主| 发表于 2025-1-6 16:53 | 显示全部楼层
总结结论
最简单 的最快 的方法
五进制每位求和 与4 求余
(3+1+1+0+0) mod 4= 1   
{ 2 4 8 6}  就步进一位
31100 中
遇见 13 不动
遇见 4 步进一位
遇见 2 步进三位(相当于后退一位)
lg :g(234552!)
(234552)10=(30001202)5
(3+0+0+0+1+2+0+2 )mod 4=0
两个2 前进 6位 一共前进 6位 就是 前进2位
结果是 4
回复 支持 反对

使用道具 举报

发表于 2025-1-7 08:18 | 显示全部楼层
A008904——a(n) 是 n!  的最后一个非零数字。

1, 1, 2, 6, 4, 2, 2, 4, 2, 8, 8, 8, 6, 8, 2, 8, 8, 6, 8, 2, 4, 4, 8, 4, 6, 4, 4, 8, 4, 6, 8, 8, 6, 8, 2, 2, 2, 4, 2, 8, 2, 2, 4, 2, 8, 6, 6, 2, 6, 4, 2, 2, 4, 2, 8, 4, 4, 8, 4, 6, 6, 6, 2, 6, 4, 6, 6, 2, 6, 4, 8, 8, 6, 8, 2, 4, 4, 8, 4, 6, 8, 8, 6, 8, 2, 2, 2, 4, 2, 8, 2, 2, 4, 2, 8, 6, 6, ...

评论——十进制数 0.1126422428...由这些数字组成的是一个超越数;参见 G. Dresden 的文章。
评论——这个序列最终不是周期性的。这可以从序列可以作为形态的固定点获得的事实中推断出来。
加一条——这个规律可以有: 个位数5=相邻个位数6, 个位数0=相邻个位数1。
2, 6, 4, 2, 2, 4, 2, 8, 8, 8,
6, 8, 2, 8, 8, 6, 8, 2, 4, 4,
8, 4, 6, 4, 4, 8, 4, 6, 8, 8,
6, 8, 2, 2, 2, 4, 2, 8, 2, 2,
4, 2, 8, 6, 6, 2, 6, 4, 2, 2,
4, 2, 8, 4, 4, 8, 4, 6, 6, 6,
2, 6, 4, 6, 6, 2, 6, 4, 8, 8,
6, 8, 2, 4, 4, 8, 4, 6, 8, 8,
6, 8, 2, 2, 2, 4, 2, 8, 2, 2,
4, 2, 8, 6, 6, 2, 6, 4, 4, 4,
8, 4, 6, 8, 8, 6, 8, 2, 2, 2,
4, 2, 8, 2, 2, 4, 2, 8, 6, 6,
2, 6, 4, 8, 8, 6, 8, 2, 6, 6,
2, 6, 4, 4, 4, 8, 4, 6, 4, 4,
8, 4, 6, 2, 2, 4, 2, 8, 2, 2,
4, 2, 8, 4, 4, 8, 4, 6, 6, 6,
2, 6, 4, 6, 6, 2, 6, 4, 8, 8,
6, 8, 2, 6, 6, 2, 6, 4, 2, 2,
4, 2, 8, 8, 8, 6, 8, 2, 8, 8,
6, 8, 2, 4, 4, 8, 4, 6, 2, 2,
4, 2, 8, 4, 4, 8, 4, 6, 6, 6,
2, 6, 4, 6, 6, 2, 6, 4, 8, 8,
6, 8, 2, 2, 2, 4, 2, 8, 4, 4,
8, 4, 6, 6, 6, 2, 6, 4, 6, 6,
2, 6, 4, 8, 8, 6, 8, 2, 8, 8,
6, 8, 2, 6, 6, 2, 6, 4, 4, 4,
8, 4, 6, 4, 4, 8, 4, 6, 2, 2,
4, 2, 8, 2, 2, 4, 2, 8, 4, 4,
8, 4, 6, 6, 6, 2, 6, 4, 6, 6,
2, 6, 4, 8, 8, 6, 8, 2, 6, 6.
2, 6, 4, 2, 2, 4, 2, 8, 8, 8,
6, 8, 2, 8, 8, 6, 8, 2, 4, 4,
8, 4, 6, 2, 2, 4, 2, 8, 4, 4,
8, 4, 6, 6, 6, 2, 6, 4, 6, 6,
2, 6, 4, 8, 8, 6, 8, 2, 2, 2,
4, 2, 8, 4, 4, 8, 4, 6, 6, 6,
2, 6, 4, 6, 6, 2, 6, 4, 8, 8,
6, 8, 2, 2, 2, 4, 2, 8, 4, 4,
8, 4, 6, 6, 6, 2, 6, 4, 6, 6,
2, 6, 4, 8, 8, 6, 8, 2, 8, 8,
6, 8, 2, 6, 6, 2, 6, 4, 4, 4,
8, 4, 6, 4, 4, 8, 4, 6, 2,...

下面2个简单的通项公式是由中国网友 northwolves 创立的——A008904还没有。谢谢 northwolves!

Table[Last[IntegerDigits[n!] /. 0 -> Nothing], {n, 0, 25}]

Table[Select[IntegerDigits[n!], # > 0 &][[-1]], {n, 0, 25}]

特别地,   n=2025。

Last[IntegerDigits[2025!] /. 0 -> Nothing]

2

Select[IntegerDigits[n2025!], # > 0 &][[-1]]

2
回复 支持 反对

使用道具 举报

发表于 2025-1-7 12:33 | 显示全部楼层
公式可以有很多,   没那2个简捷。
  1. Table[Drop[IntegerDigits[n!], -Sum[Floor[n/5^k], {k, Log[5, n]}]][[-1]], {n, 0, 25}]
复制代码
  1. Table[Block[{d = IntegerDigits[n!]}, While[d[[-1]] == 0, d = Most@d]; d[[-1]]], {n, 0, 25}]
复制代码
回复 支持 反对

使用道具 举报

发表于 2025-1-7 15:56 | 显示全部楼层
1,(1)1,(2)2,(3)6,(4)4,(3)2,(1)2,(2)4,(3)2,(4)8,(1)
8,(1)8,(2)6,(3)8,(4)2,(4)8,(1)8,(2)6,(3)8,(4)2,(2)
4,(1)4,(2)8,(3)4,(4)6,(4)4,(1)4,(2)8,(3)4,(4)6,(3)
8,(1)8,(2)6,(3)8,(4)2,(1)2,(1)2,(2)4,(3)2,(4)8,(4)
2,(1)2,(2)4,(3)2,(4)8,(2)6,(1)6,(2)2,(3)6,(4)4,(3)
2,(1)2,(2)4,(3)2,(4)8,(3)4,(1)4,(2)8,(3)4,(4)6,(1)
6,(1)6,(2)2,(3)6,(4)4,(4)6,(1)6,(2)2,(3)6,(4)4,(2)
8,(1)8,(2)6,(3)8,(4)2,(2)4,(1)4,(2)8,(3)4,(4)6,(3)
8,(1)8,(2)6,(3)8,(4)2,(1)2,(1)2,(2)4,(3)2,(4)8,(4)
2,(1)2,(2)4,(3)2,(4)8,(2)6,(1)6,(2)2,(3)6,(4)4,(1)
4,(2)4,(2)8,(3)4,(4)6,(3)8,(1)8,(2)6,(3)8,(4)2,(1)
2,(1)2,(2)4,(3)2,(4)8,(4)2,(1)2,(2)4,(3)2,(4)8,(2)
6,(1)6,(2)2,(3)6,(4)4,(2)8,(1)8,(2)6,(3)8,(4)2,(3)
6,(1)6,(2)2,(3)6,(4)4,(1)4,(1)4,(2)8,(3)4,(4)6,(4)
4,(1)4,(2)8,(3)4,(4)6,(2)2,(1)2,(2)4,(3)2,(4)8,(4)
2,(1)2,(2)4,(3)2,(4)8,(3)4,(1)4,(2)8,(3)4,(4)6,(1)
6,(1)6,(2)2,(3)6,(4)4,(4)6,(1)6,(2)2,(3)6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 8,(3)
4, 4, 8, 4, 6,(1)6, 6, 2, 6, 4,(4)
6, 6, 2, 6, 4,(2)8, 8, 6, 8, 2,(1)
2, 2, 4, 2, 8,(3)4, 4, 8, 4, 6,(1)
6, 6, 2, 6, 4,(4)6, 6, 2, 6, 4,(2)
8, 8, 6, 8, 2,(4)8, 8, 6, 8, 2,(3)
6, 6, 2, 6, 4,(1)4, 4, 8, 4, 6,(4)
4, 4, 8, 4, 6,(2)2, 2, 4, 2, 8,(4)
2, 2, 4, 2, 8,(3)4, 4, 8, 4, 6,(1)
6, 6, 2, 6, 4,(4)6, 6, 2, 6, 4,(2)
8, 8, 6, 8, 2,(3)6, 6, 2, 6, 4,(3)
2, 2, 4, 2, 8,(1)8, 8, 6, 8, 2,(4)
8, 8, 6, 8, 2,(2)4, 4, 8, 4, 6,(2)
2, 2, 4, 2, 8,(3)4, 4, 8, 4, 6,(1)
6, 6, 2, 6, 4,(4)6, 6, 2, 6, 4,(2)
8, 8, 6, 8, 2,(1)2, 2, 4, 2, 8,(3)
4, 4, 8, 4, 6,(1)6, 6, 2, 6, 4,(4)
6, 6, 2, 6, 4,(2)8, 8, 6, 8, 2,()

还真是个无理数。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

LaTEX预览输入 教程 符号库 加行内标签 加行间标签 
对应的 LaTEX 效果:

Archiver|手机版|小黑屋|数学中国 ( 京ICP备05040119号 )

GMT+8, 2025-7-12 17:49 , Processed in 0.082912 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表
\frac{\square}{\square}\sqrt{\square}\square_{\baguet}^{\baguet}\overarc{\square}\ \dot{\baguet}\left(\square\right)\binom{\square}{\square}\begin{cases}\square\\\square\end{cases}\ \begin{bmatrix}\square&\square\\\square&\square\end{bmatrix}\to\Rightarrow\mapsto\alpha\ \theta\ \pi\times\div\pm\because\angle\ \infty
\frac{\square}{\square}\sqrt{\square}\sqrt[\baguet]{\square}\square_{\baguet}\square^{\baguet}\square_{\baguet}^{\baguet}\sum_{\baguet}^{\baguet}\prod_{\baguet}^{\baguet}\coprod_{\baguet}^{\baguet}\int_{\baguet}^{\baguet}\lim_{\baguet}\lim_{\baguet}^{\baguet}\bigcup_{\baguet}^{\baguet}\bigcap_{\baguet}^{\baguet}\bigwedge_{\baguet}^{\baguet}\bigvee_{\baguet}^{\baguet}
\underline{\square}\overline{\square}\overrightarrow{\square}\overleftarrow{\square}\overleftrightarrow{\square}\underrightarrow{\square}\underleftarrow{\square}\underleftrightarrow{\square}\dot{\baguet}\hat{\baguet}\vec{\baguet}\tilde{\baguet}
\left(\square\right)\left[\square\right]\left\{\square\right\}\left|\square\right|\left\langle\square\right\rangle\left\lVert\square\right\rVert\left\lfloor\square\right\rfloor\left\lceil\square\right\rceil\binom{\square}{\square}\boxed{\square}
\begin{cases}\square\\\square\end{cases}\begin{matrix}\square&\square\\\square&\square\end{matrix}\begin{pmatrix}\square&\square\\\square&\square\end{pmatrix}\begin{bmatrix}\square&\square\\\square&\square\end{bmatrix}\begin{Bmatrix}\square&\square\\\square&\square\end{Bmatrix}\begin{vmatrix}\square&\square\\\square&\square\end{vmatrix}\begin{Vmatrix}\square&\square\\\square&\square\end{Vmatrix}\begin{array}{l|l}\square&\square\\\hline\square&\square\end{array}
\to\gets\leftrightarrow\nearrow\searrow\downarrow\uparrow\updownarrow\swarrow\nwarrow\Leftarrow\Rightarrow\Leftrightarrow\rightharpoonup\rightharpoondown\impliedby\implies\Longleftrightarrow\leftharpoonup\leftharpoondown\longleftarrow\longrightarrow\longleftrightarrow\Uparrow\Downarrow\Updownarrow\hookleftarrow\hookrightarrow\mapsto
\alpha\beta\gamma\Gamma\delta\Delta\epsilon\varepsilon\zeta\eta\theta\Theta\iota\kappa\varkappa\lambda\Lambda\mu\nu\xi\Xi\pi\Pi\varpi\rho\varrho\sigma\Sigma\tau\upsilon\Upsilon\phi\Phi\varphi\chi\psi\Psi\omega\Omega\digamma\vartheta\varsigma\mathbb{C}\mathbb{H}\mathbb{N}\mathbb{P}\mathbb{Q}\mathbb{R}\mathbb{Z}\Re\Im\aleph\partial\nabla
\times\cdot\ast\div\pm\mp\circ\backslash\oplus\ominus\otimes\odot\bullet\varnothing\neq\equiv\not\equiv\sim\approx\simeq\cong\geq\leq\ll\gg\succ\prec\in\ni\cup\cap\subset\supset\not\subset\not\supset\notin\not\ni\subseteq\supseteq\nsubseteq\nsupseteq\sqsubset\sqsupset\sqsubseteq\sqsupseteq\sqcap\sqcup\wedge\vee\neg\forall\exists\nexists\uplus\bigsqcup\bigodot\bigotimes\bigoplus\biguplus\bigcap\bigcup\bigvee\bigwedge
\because\therefore\angle\parallel\perp\top\nparallel\measuredangle\sphericalangle\diamond\diamondsuit\doteq\propto\infty\bowtie\square\smile\frown\bigtriangledown\triangle\triangleleft\triangleright\bigcirc \wr\amalg\models\preceq\mid\nmid\vdash\dashv\nless\ngtr\ldots\cdots\vdots\ddots\surd\ell\flat\sharp\natural\wp\clubsuit\heartsuit\spadesuit\oint\lfloor\rfloor\lceil\rceil\lbrace\rbrace\lbrack\rbrack\vert\hbar\aleph\dagger\ddagger

MathQuill输入:

Latex代码输入: