3
3

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.

法事が素数の理由

3
Last updated at Posted at 2017-06-23

みんな同じ周期[1,3,7,13,17,23,27,33,50]を共有している以上どの周期でも変わらないんじゃないのって思ったので調べました
素数じゃ無い周期としては適当に足し引きして[1,3,6,14,16,24,26,34,50]を使用

import random
from collections import Counter

hoji = [1,3,7,13,17,23,27,33,50]
hoji_notSosu =[1,3,6,14,16,24,26,34,50]

# 50年の間に100万人死ぬ、死んだ年度

hyaku_man_nin_sinu = [random.randint(1,50) for i in range(1000000)]

# 法事の年度

nendo_hoji = []
nendo_hoji_notSosu = []

for shinda_toshi in hyaku_man_nin_sinu:
    hoji_no_toshi = []
    for kaiki in hoji:
        nendo_hoji.append(shinda_toshi + kaiki)
    for kaiki in hoji_notSosu:
        nendo_hoji_notSosu.append(shinda_toshi + kaiki)

counter1 = Counter(nendo_hoji)
counter2 = Counter(nendo_hoji_notSosu)
print("素数の場合")
for houji_no_nendo, hindo in counter1.most_common(5):
    print (houji_no_nendo, hindo)
print("素数じゃない場合")
for houji_no_nendo, hindo in counter2.most_common(5):
    print (houji_no_nendo, hindo)    

出力 (法事が行われる年度 : 回数)

素数の場合
51 179800
34 160753
35 160426
38 160385
40 160334
素数じゃない場合
51 180404
41 160986
46 160766
36 160649
37 160403

あんま変わらなくない?

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?