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

べき乗のmod

Last updated at Posted at 2020-06-10

#大きい数同士のべき乗には、pow(a,b,z)を使う

#####自分用のメモです。一回みたことあったのに忘れてた&自分で実装できなくて時間とかした。これを使うと、a**b % z を秒でしてくれる。今度どういう仕組みで動いてるのか調べてみることにします。

再帰で書こうとしたら、再帰の上限回数(自分は3000)こえたらしくて上手く処理できなかった。なーんでだろう?

ちなみに、上限回数は、
import sys
print(sys.getrecursionlimit())

で調べられる。

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