From 97fbe845e5dfdbda22521117c1783e1fd8515952 Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Mon, 12 Jul 2021 20:52:49 -0700 Subject: Random changes. --- math_utils.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'math_utils.py') diff --git a/math_utils.py b/math_utils.py index 2e12699..56fb707 100644 --- a/math_utils.py +++ b/math_utils.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import functools 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 +@functools.lru_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): -- cgit v1.3