MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / fibonacci_modP

Function fibonacci_modP

Python/CP_Templates.py:35–37  ·  view source on GitHub ↗
(n, MOD)

Source from the content-addressed store, hash-verified

33
34
35def fibonacci_modP(n, MOD):
36 if n < 2: return 1
37 return (cached_fn(fibonacci_modP, (n + 1) // 2, MOD) * cached_fn(fibonacci_modP, n // 2, MOD) + cached_fn(fibonacci_modP, (n - 1) // 2, MOD) * cached_fn(fibonacci_modP, (n - 2) // 2, MOD)) % MOD
38
39
40def factorial_modP_Wilson(n, p):

Callers

nothing calls this directly

Calls 1

cached_fnFunction · 0.85

Tested by

no test coverage detected