projects
/
python_utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Random changes.
[python_utils.git]
/
math_utils.py
diff --git
a/math_utils.py
b/math_utils.py
index 2e126990fba0d7b9138f4a4b6238440aae89bb82..56fb7072366ab97621e032e9aed11d13d7740b5e 100644
(file)
--- a/
math_utils.py
+++ b/
math_utils.py
@@
-1,5
+1,6
@@
#!/usr/bin/env python3
#!/usr/bin/env python3
+import functools
import math
from typing import List
from heapq import heappush, heappop
import math
from typing import List
from heapq import heappush, heappop
@@
-60,6
+61,7
@@
def truncate_float(n: float, decimals: int = 2):
return int(n * multiplier) / multiplier
return int(n * multiplier) / multiplier
[email protected]
_cache(maxsize=1024, typed=True)
def is_prime(n: int) -> bool:
"""Returns True if n is prime and False otherwise"""
if not isinstance(n, int):
def is_prime(n: int) -> bool:
"""Returns True if n is prime and False otherwise"""
if not isinstance(n, int):