Last active
September 24, 2021 13:14
-
-
Save AlexLynd/b806326be0e0c2f2c04218af2bd0c5c1 to your computer and use it in GitHub Desktop.
ACSL Senior Contest 1 [2019-20]
This file contains 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 prime(n): | |
count = []; | |
while n%2 == 0: | |
count.append(2) | |
n = n/2 | |
for i in range(3,int(n**.5)+1,2): | |
while n%i == 0: | |
count.append (i) | |
n = n/i | |
if n>2: count.append(int(n)) | |
return(len(list(set(count)))) | |
for i in range(5): | |
n,p = input("Positive integer: "), input("Position: ") | |
r = len(n)-int(p) | |
f = "" | |
for i in range(len(n)) : | |
if (i<r): f+= str(int(n[i])+int(n[r])) | |
elif (i>r): f+= str(abs(int(n[i])-int(n[r]))) | |
else: f+= str(prime(int(n))) | |
print(f+"\n-------------------------") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment