Skip to content

Fix run error in Project Euler problem 104 solution 1 #7604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion DIRECTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
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:
"""
Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down