Created
February 20, 2025 13:24
-
-
Save bananu7/81b29a691e1113449d6df82b0d762339 to your computer and use it in GitHub Desktop.
Skrypt do szukania ksiąg wieczystych
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
weights = { | |
"0": 0, | |
"1": 1, | |
"2": 2, | |
"3": 3, | |
"4": 4, | |
"5": 5, | |
"6": 6, | |
"7": 7, | |
"8": 8, | |
"9": 9, | |
"X": 10, | |
"A": 11, | |
"B": 12, | |
"C": 13, | |
"D": 14, | |
"E": 15, | |
"F": 16, | |
"G": 17, | |
"H": 18, | |
"I": 19, | |
"J": 20, | |
"K": 21, | |
"L": 22, | |
"M": 23, | |
"N": 24, | |
"O": 25, | |
"P": 26, | |
"R": 27, | |
"S": 28, | |
"T": 29, | |
"U": 30, | |
"W": 31, | |
"Y": 32, | |
"Z": 33, | |
} | |
biases = [1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7] | |
def compute_control(kw_str): | |
sum = 0 | |
for i in range(0, 12): | |
sum += biases[i] * weights[kw_str[i]] | |
return sum % 10 | |
def generate(n): | |
act_n = n * 10 + 9 # ends with 9 | |
if compute_control("GD1Y" + "{:08d}".format(act_n)) == 5: | |
return "GD1Y/" + "{:08d}".format(act_n) + "/5" | |
else: | |
return None | |
def gen_between(a, b): | |
for i in range(a, b + 1): | |
k = generate(i) | |
if k: | |
print(k) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment