File tree 2 files changed +40
-0
lines changed
2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ a = [1 ]
2
+
3
+ # calculate 30 values
4
+ for i in range (1 , 31 ):
5
+ # a[i] base
6
+ base = str (a [i - 1 ])
7
+ base_len = len (base )
8
+ result = "0"
9
+ j = 0
10
+ count = 1
11
+ while j + 1 < base_len :
12
+ if base [j + 1 ] == base [j ]:
13
+ count += 1
14
+ j += 1
15
+ else :
16
+ result += str (count )
17
+ result += str (base [j ])
18
+ j += 1
19
+ count = 1
20
+ if j + 1 == base_len :
21
+ result += str (count )
22
+ result += str (base [j ])
23
+ a .append (int (result ))
24
+
25
+ print (a )
26
+ print (len (str (a [30 ])))
Original file line number Diff line number Diff line change 1
1
# pythonchallenge
2
2
Solve Problems in http://www.pythonchallenge.com
3
3
4
+ #### 10
5
+ result: http://www.pythonchallenge.com/pc/return/5808.html
6
+
7
+ with pycharm IDE, I can debug the code easier.
8
+
9
+ the method of find rule of ** a** is: look at ** a[ i - 1] ** , do count
10
+ 1
11
+ the next is one 1: 11
12
+ the next is two 1: 21
13
+ the next is one 2 one 1: 1211
14
+ the next is one 1 one 2 two 2: 111221
15
+ the next is three 1 two 2 one 1: 312211
16
+
17
+
4
18
#### 9
5
19
result:http://www.pythonchallenge.com/pc/return/bull.html
6
20
You can’t perform that action at this time.
0 commit comments