7
7

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 5 years have passed since last update.

素数の逆数和って本当に発散すんのかよって話

Posted at

なんか簡単に証明できるっていうけどまじかよってことで
pythonで書いてみました。
練習も兼ねて
コードはこちら

prime.py
  1 import matplotlib.pyplot as plt
  2 
  3 def prime(value):
  4         for num in range(2,value):
  5                 if value%num==0:
  6                         return -1
  7         return 1
  8 list=[]
  9 for num in range(2,10000000):
 10         if prime(num)>0:
 11                 list.append(num)
 12 print list
 13 list2=[]
 14 for num in list:
 15         list2.append(1.0/num)
 16 list3=[]
 17 sum=0
 18 for num in list2:
 19         sum=sum+num
 20         list3.append(sum)
 21 plt.plot(list3)
 22 plt.show()

出てきたグラフは見てのお楽しみ〜

7
7
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
7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?