From d407476531dd85db79e58aa2dd13d3b3031d8185 Mon Sep 17 00:00:00 2001 From: Maxim Smolskiy Date: Tue, 25 Oct 2022 03:57:03 +0300 Subject: [PATCH] fix: increase str conversion limit where required (#7604) Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> --- DIRECTORY.md | 8 +++++++- project_euler/problem_104/{sol.py.FIXME => sol1.py} | 10 +++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) rename project_euler/problem_104/{sol.py.FIXME => sol1.py} (95%) diff --git a/DIRECTORY.md b/DIRECTORY.md index 16e6b7ae3..3e722a878 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -55,6 +55,7 @@ * [Modular Division](blockchain/modular_division.py) ## Boolean Algebra + * [And Gate](boolean_algebra/and_gate.py) * [Norgate](boolean_algebra/norgate.py) * [Quine Mc Cluskey](boolean_algebra/quine_mc_cluskey.py) @@ -876,6 +877,8 @@ * [Sol1](project_euler/problem_101/sol1.py) * Problem 102 * [Sol1](project_euler/problem_102/sol1.py) + * Problem 104 + * [Sol1](project_euler/problem_104/sol1.py) * Problem 107 * [Sol1](project_euler/problem_107/sol1.py) * Problem 109 @@ -948,6 +951,7 @@ * [Quantum Random](quantum/quantum_random.py) * [Ripple Adder Classic](quantum/ripple_adder_classic.py) * [Single Qubit Measure](quantum/single_qubit_measure.py) + * [Superdense Coding](quantum/superdense_coding.py) ## Scheduling * [First Come First Served](scheduling/first_come_first_served.py) @@ -1037,7 +1041,6 @@ * [Can String Be Rearranged As Palindrome](strings/can_string_be_rearranged_as_palindrome.py) * [Capitalize](strings/capitalize.py) * [Check Anagrams](strings/check_anagrams.py) - * [Check Pangram](strings/check_pangram.py) * [Credit Card Validator](strings/credit_card_validator.py) * [Detecting English Programmatically](strings/detecting_english_programmatically.py) * [Dna](strings/dna.py) @@ -1046,6 +1049,8 @@ * [Indian Phone Validator](strings/indian_phone_validator.py) * [Is Contains Unique Chars](strings/is_contains_unique_chars.py) * [Is Palindrome](strings/is_palindrome.py) + * [Is Pangram](strings/is_pangram.py) + * [Is Spain National Id](strings/is_spain_national_id.py) * [Jaro Winkler](strings/jaro_winkler.py) * [Join](strings/join.py) * [Knuth Morris Pratt](strings/knuth_morris_pratt.py) @@ -1090,6 +1095,7 @@ * [Fetch Well Rx Price](web_programming/fetch_well_rx_price.py) * [Get Imdb Top 250 Movies Csv](web_programming/get_imdb_top_250_movies_csv.py) * [Get Imdbtop](web_programming/get_imdbtop.py) + * [Get Top Billioners](web_programming/get_top_billioners.py) * [Get Top Hn Posts](web_programming/get_top_hn_posts.py) * [Get User Tweets](web_programming/get_user_tweets.py) * [Giphy](web_programming/giphy.py) diff --git a/project_euler/problem_104/sol.py.FIXME b/project_euler/problem_104/sol1.py similarity index 95% rename from project_euler/problem_104/sol.py.FIXME rename to project_euler/problem_104/sol1.py index 0818ac401..60fd6fe99 100644 --- a/project_euler/problem_104/sol.py.FIXME +++ b/project_euler/problem_104/sol1.py @@ -13,6 +13,10 @@ Given that Fk is the first Fibonacci number for which the first nine digits AND the last nine digits are 1-9 pandigital, find k. """ +import sys + +sys.set_int_max_str_digits(0) # type: ignore + def check(number: int) -> bool: """ @@ -34,7 +38,7 @@ def check(number: int) -> bool: check_front = [0] * 11 # mark last 9 numbers - for x in range(9): + for _ in range(9): check_last[int(number % 10)] = 1 number = number // 10 # flag @@ -51,7 +55,7 @@ def check(number: int) -> bool: # mark first 9 numbers number = int(str(number)[:9]) - for x in range(9): + for _ in range(9): check_front[int(number % 10)] = 1 number = number // 10 @@ -81,7 +85,7 @@ def check1(number: int) -> bool: check_last = [0] * 11 # mark last 9 numbers - for x in range(9): + for _ in range(9): check_last[int(number % 10)] = 1 number = number // 10 # flag