Advertisement
k1alo

Untitled

Feb 18th, 2025
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. def f(x, h):
  2.     if (h == 3 or h == 5) and x >= 46:
  3.         return 1
  4.     if h == 5 and x < 46:
  5.         return 0
  6.     if h < 5 and x < 46:
  7.         return 0
  8.     else:
  9.         if h % 2 == 0:
  10.             return f(x + 1, h + 1) or f(x * 2, h + 1)
  11.         else:
  12.             return f(x + 1, h + 1) and f(x * 2, h + 1)
  13.  
  14. def f1(x, h):
  15.     if h == 3 and x >= 46:
  16.         return 1
  17.     if h < 3 and x > 46:
  18.         return 0
  19.     if h == 3 and x < 46:
  20.         return 0
  21.     else:
  22.         if h % 2 == 0:
  23.             return f1(x + 1, h + 1) or f1(x * 2, h + 1)
  24.         else:
  25.             return f1(x + 1, h + 1) and f1(x * 2, h + 1)
  26.  
  27. for x in range(46):
  28.     if f(x, 1) == 1:
  29.         print(x)
  30. print("--------------")
  31. for x in range(46):
  32.     if f1(x, 1) == 1:
  33.         print(x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement