Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. from math import gcd
  2. import sys
  3.  
  4. def kek(nums, my):
  5. for num in nums:
  6. res = gcd(num, my)
  7. if res != 1:
  8. a = my // res
  9. if a * res == my:
  10. return res, a
  11.  
  12. def main():
  13. with open('Laboratornaya_1.rtf') as f:
  14. nums = [int(line[3:-3]) for line in f if line.startswith('n2')]
  15. my = nums.pop(int(sys.argv[1]) - 1)
  16. res = kek(nums, my)
  17. print(f'Num1:\n{res[0]}\nNum2:\n{res[1]}')
  18.  
  19. if __name__ == "__main__":
  20. print('Usage: python3 parse.py <num in group>')
  21. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement