[Code]
CONVAY SERIE GENERATOR
You know Convay serie is: 1, 11, 21, 1211, 111221, ...
Python code to generate this as wish is below. Change while s < 20: as your limit: while s < max value:
a = "1"
s = 0
while s < 20:
s += 1
c = a[0]
n = 0
d = ""
e = ""
while n < len(a):
if a[n] == c:
d+=c
else:
e += str(len(d)) + c
c = a[n]
d = c
n += 1
e += str(len(d)) + c
a = e
print(len(e), "-", e)
Info: All codes are written and solutions found by myself in this site.
Ali Eskici
13.10.2024