Что делают последние 2 строки return 1 if qwe(sum(map(int, list (A)))) else 0 print(min([w for w in range(49, 100) if asd('1' * 48 + '2' * w)]))
def qwe(q):
for w in range(2, int(q ** 0.5) + 1):
if q % w ==0:
return 0
return q > 1
def asd(e):
A = '0' + e + '0'
while '00' not in A:
A = A.replace ('02', '101')
A = A.replace ('11', '2')
A = A.replace ('012', '30')
A = A.replace ('010', '00')
return 1 if qwe(sum(map(int, list (A)))) else 0
print(min([w for w in range(49, 100) if asd('1' * 48 + '2' * w)]))