Skip to content
This repository was archived by the owner on May 22, 2026. It is now read-only.

Commit 49fb756

Browse files
chore
1 parent 3b188bc commit 49fb756

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

math/fermat/fermat.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
{-# LANGUAGE NumDecimals #-}
2+
13
import Data.Int (Int64)
24

35
-- 法となる素数: 32 bit整数の最大値である2.1 * 10^9に近い
46
modulus :: Int64
5-
modulus = 10 ^ 9 + 7
7+
-- modulus = 10 ^ 9 + 7
8+
modulus = 1e9 + 7 -- NumDecimals拡張を使うとコンパイル時に1000000007に展開される。
69

710
-- 繰り返し二乗法による (n^k) mod modulus の計算
811
-- e.g. x^9の場合: x^2 = x * x

0 commit comments

Comments
 (0)