Farz0l1x

Untitled

Dec 2nd, 2023
809
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 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. for n in range(1, 100000):
  9.     n = f(n)
  10.     if int(n) % 4 == 0:
  11.         n = n + n[-3:]
  12.     else:
  13.         n = n + f((int(n) % 4) * 4)
  14.     R = int(n, 3)
  15.     if R < 127:
  16.         print(R)
Advertisement
Add Comment
Please, Sign In to add comment