Advertisement
Farz0l1x

Untitled

Apr 17th, 2024
508
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. def f(n):
  2.     s = ''
  3.     while n > 0:
  4.         s += str(n % 19)
  5.         n //= 19
  6.     s = s[::-1]
  7.     return s
  8. M = 0
  9. for x in range(1, 20):
  10.     a = 9 * 19**7 + 8 * 19**6 + x * 19**5 + 7 * 19**4 + 9 * 19**3 + 6 * 19**2 + 4 * 19 + 1
  11.     b = 3 * 19**4 + 6 * 19**3 + x * 19**2 + 19 + 4
  12.     c = 7 * 19**3 + 3 * 19**2 + x * 19 + 4
  13.     if a + b + c % 18 == 0:
  14.         M = max(M, x)
  15.    
  16. A = 9 * 19**7 + 8 * 19**6 + M * 19**5 + 7 * 19**4 + 9 * 19**3 + 6 * 19**2 + 4 * 19 + 1
  17. B = 3 * 19**4 + 6 * 19**3 + M * 19**2 + 19 + 4
  18. C = 7 * 19**3 + 3 * 19**2 + M * 19 + 4
  19. print((A + B + C) // 18)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement