Python Code: import math as lp def digit(a): sum=0 for i in range(len(a)): sum+=a[i] return sum n=10000000 #預算的最後一個數字 number=[] for m in range(1,n+1): p=[] q=[] d=int(lp.log10(m))+1 k=m+2 d2=int(lp.log10(k))+1 for i in range(d): l=m%10 p.append(l) m=m//10 for j in range(d2): l2=k%10 q.append(l2) k=k//10 number.append(abs(digit(q)-digit(p))) number=set(number) number=sorted(number) print(number) (1)當x=1~1000時,T(x)=[2, 7, 16, 25] (2)當x=1~10000時,T(x)=[2, 7, 16, 25,34] (3)當x=1~100000時,T(x)=[2, 7, 16, 25,34,43] ..... ....... .......... (4)當x=1~10^224時,T(x)=[2, 7, 16, 25,34,43,......,2014] 共有225個數字 答案:有225個 T(x) 值不超過2019