Advertisement
Farz0l1x

Untitled

Feb 27th, 2024
559
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. def Sum(s):
  2.     Sum = 0
  3.     for i in range(len(s)):
  4.         Sum += int(s[i])
  5.     return Sum
  6.  
  7. for n in range(4, 10_000):
  8.     s = '5' + '2' * n
  9.     while '52' in s or '2222' in s or '1122' in s:
  10.         if '52' in s:
  11.             s = s.replace('52', '11', 1)
  12.         if '2222' in s:
  13.             s = s.replace('2222', '5', 1)
  14.         if '1122' in s:
  15.             s = s.replace('1122', '25', 1)
  16.     if Sum(s) % 10 == 7:
  17.         print(n)
  18.         break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement