Mathematica趣味题集
有三位以上的十进制数字,数位不含有0。假设满足,任意千位以上数字均是其后两位数字的和,请问
这种数字一共多少个?
题目来源:http://bbs.emath.ac.cn/redirect.php?tid=2694&goto=lastpost
Clear[f] f[x_, y_] := Module[{n = 0, a = x, b = y, t, res = {}}, t = a*10 + b; While[a + b < 10, n = a + b; t = ToString[n] <> ToString[t]; res = Append[res, t]; b = a; a = n;]; Return[res];] ToExpression /@ Gather[Flatten@Table[f[i, j], {i, 9}, {j, 9}], StringLength[#1] == StringLength[#2] &]