Advertisement
HabKaffee

Untitled

Dec 5th, 2021
721
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. def func(num, base):
  2.     num_copy = num
  3.     num_str = ''
  4.     while num > 0:
  5.         num_str += str(num % base)
  6.         num //= base
  7.     num_str = str(num_copy % base) + num_str
  8.     R = 0
  9.     for i in range(len(num_str)):
  10.         R += int(num_str[i])*(base**i)
  11.     return R
  12.  
  13. for i in range(1, 10000000):
  14.     res = func(i, 3)
  15.     if (res >= 1000) and (res < 10000):
  16.         print(res)
  17.         break
  18.    
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement