Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def f(n):
- s = ''
- while n > 0:
- s += str(n % 19)
- n //= 19
- s = s[::-1]
- return s
- M = 0
- for x in range(1, 20):
- a = 9 * 19**7 + 8 * 19**6 + x * 19**5 + 7 * 19**4 + 9 * 19**3 + 6 * 19**2 + 4 * 19 + 1
- b = 3 * 19**4 + 6 * 19**3 + x * 19**2 + 19 + 4
- c = 7 * 19**3 + 3 * 19**2 + x * 19 + 4
- if a + b + c % 18 == 0:
- M = max(M, x)
- A = 9 * 19**7 + 8 * 19**6 + M * 19**5 + 7 * 19**4 + 9 * 19**3 + 6 * 19**2 + 4 * 19 + 1
- B = 3 * 19**4 + 6 * 19**3 + M * 19**2 + 19 + 4
- C = 7 * 19**3 + 3 * 19**2 + M * 19 + 4
- print((A + B + C) // 18)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement