Sichanov

prime

Apr 16th, 2021 (edited)
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.08 KB | None | 0 0
  1. start_first_pair_value = int(input())
  2. start_second_pair_value = int(input())
  3. diff_first_pair = int(input())
  4. diff_second_pair = int(input())
  5. first_prime_pair = 0
  6. second_prime_pair = 0
  7. counter = 0
  8. first_pair_found = False
  9. second_pair_found = False
  10.  
  11. for first_pair in range(start_first_pair_value, ((start_first_pair_value + diff_first_pair) + 1)):
  12.     for n in range(1, first_pair + 1):
  13.         if first_pair % n == 0:
  14.             counter += 1
  15.     if counter <= 2:
  16.         first_prime_pair = first_pair
  17.         first_pair_found = True
  18.     counter = 0
  19.     for second_pair in range(start_second_pair_value, ((start_second_pair_value + diff_second_pair) + 1)):
  20.         for n in range(1, second_pair + 1):
  21.             if second_pair % n == 0:
  22.                 counter += 1
  23.         if counter <= 2:
  24.             second_prime_pair = second_pair
  25.             second_pair_found = True
  26.             if first_pair_found and second_pair_found:
  27.                 print(f"{first_prime_pair}{second_prime_pair}")
  28.         counter = 0
  29.    
  30.     first_pair_found = False
  31.     second_pair_found = False
  32.  
Add Comment
Please, Sign In to add comment