Created
March 10, 2022 04:38
-
-
Save igorvanloo/e6dc458875ca94e450d39346a941c996 to your computer and use it in GitHub Desktop.
pe358
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
def sum_decimals(num, den): | |
num_digits = 0 | |
digit_sum = 0 | |
while True: | |
num *= 10 | |
temp = math.floor(num/den) | |
digit_sum += temp | |
num_digits += 1 | |
num -= temp*den | |
if num == 1: | |
break | |
return digit_sum, num_digits | |
def compute(): | |
start = int((10**11/138)) | |
end = int((10**11/137)) | |
for x in range(start, end): | |
if pow(2, x, x) == 2 and pow(3, x, x) == 3: #Fermats little theorem checker | |
if is_prime(x): #confirm its a prime | |
if (56789 * x) % 100000 == 99999 and (((56789 * x) + 1) % 100000) == 0: | |
digit_sum, num_digits = sum_decimals(1, x) | |
if num_digits == (x-1): | |
return digit_sum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment