Farz0l1x

Untitled

Oct 28th, 2023
731
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. def f(n):
  2.     s = ""
  3.     while n > 0:
  4.         s += str(n % 3)
  5.         n //= 3
  6.     s = s[::-1]
  7.     return s
  8.  
  9. Max = 0
  10. for n in range(1, 100000):
  11.     b = f(n)
  12.     if n % 4 == 0:
  13.         b = b + b[-3:]
  14.     else:
  15.         b = b + f((n % 4) * 4)
  16.     R = int(b, 3)
  17.     if R > 127:
  18.         Max = max(Max, R)
  19. print(Max)
Advertisement
Add Comment
Please, Sign In to add comment