Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def nwd(a, b):
- if b > 0:
- return nwd(b, a%b)
- return a
- liczby = []
- with open('liczby.txt', 'r') as file:
- liczby = [int(x) for x in file.read().splitlines()]
- naj = 0
- """ for i in range(0, len(liczby)):
- for j in range(0, len(liczby)):
- if nwd(liczby[i], liczby[j]) > 1:
- continue
- if liczby[i] > naj:
- naj = liczby[i]
- osti = liczby[i]
- ostj = liczby[j] """
- naj = 0
- for i in liczby:
- ok = True
- for j in liczby:
- if nwd(i, j) > 1 and i != j:
- ok = False
- if i > naj and ok:
- naj = i
- print('Największa: ', naj)
Advertisement
Add Comment
Please, Sign In to add comment