1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

「 [トリビアの泉]1から9の数字が重複な...」を参考にSymPy Liveでやってみたい。

Last updated at Posted at 2021-10-25

証明になりますか?教えて下さい。

オリジナル 証明すッゾォ<

SymPy Liveで

以下サイトに、ソースコードを貼り付けて、Evaluateです。

from sympy import *
var('i n p')
p=symbols('p', cls=Function)
n=9
f1=  Sum( 10**(n-i)     *p(n-i),(i, 1, n  ))
f2=9*Sum((10**(n-i)-1)/9*p(n-i),(i, 1, n-1))
print("#",simplify(f1-f2))
print("#",simplify(f2+simplify(f1-f2)))
print("#",simplify(Sum(i,(i,1,n ))).doit() % 9)
# p(0) + p(1) + p(2) + p(3) + p(4) + p(5) + p(6) + p(7) + p(8)
# p(0) + 10*p(1) + 100*p(2) + 1000*p(3) + 10000*p(4) + 100000*p(5) + 1000000*p(6) + 10000000*p(7) + 100000000*p(8)
# 0
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?