Advertisement
Brusnik

Untitled

Jul 4th, 2025
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.25 KB | None | 0 0
  1. # Задание №1
  2.  
  3. for x in range (1, 11):
  4.     for y in range(1, 11):
  5.         print(x*y, ' ' * (3- len(str(x*y))), end ='')
  6.     print()
  7.  
  8. # Задание №2
  9.  
  10. ans_2 = 0
  11. for x in range(10, 51):
  12.     for y in range(10, 51):
  13.         for k in range(10, 51):
  14.             if x**2 + y**2 == k**2:
  15.                 ans_2 += 1
  16.  
  17. print(ans_2)
  18.  
  19.  
  20. # Задание №3
  21.  
  22. for i in range(299):
  23.     for j in range(i+1, 300):
  24.         num_1 = []
  25.         num_2 = []
  26.         for n_1 in range(2, int(j**0.5)+1):
  27.             if j % n_1 == 0:
  28.                 num_1.append(n_1)
  29.                 n_1_dop = j // n_1
  30.                 if n_1_dop != n_1:
  31.                     num_1.append(n_1_dop)
  32.  
  33.         for n_2 in range(2, int(i**0.5)+1):
  34.             if i % n_2 == 0:
  35.                 num_2.append(n_2)
  36.                 n_2_dop = i // n_2
  37.                 if n_2_dop != n_2:
  38.                     num_2.append(n_2_dop)
  39.  
  40.         if sum(num_2) + 1 == j and sum(num_1) + 1 == i:
  41.             print(i, j)
  42.  
  43.  
  44. # Задание №4
  45.  
  46. for i in range(10000):
  47.     n = str(i)
  48.     if len(n) == 4:
  49.         a = int(str(n[0]))
  50.         b = int(str(n[1]))
  51.         c = int(str(n[2]))
  52.         d = int(str(n[3]))
  53.         if a**4 + b**4 + c**4 + d**4 == i:
  54.             print(i, end=' ')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement