Commit 4cb650ba authored by Siu, Pui Chung's avatar Siu, Pui Chung
Browse files

Add new file

parent c787b7e2
def dbl_linear(n):
list = [1]
y_pos = 0
z_pos = 0
while len(list) <= n:
y = 2 * list[y_pos] + 1
z = 3 * list[z_pos] + 1
if y > z:
list.append(z)
z_pos += 1
elif y < z:
list.append(y)
y_pos += 1
elif y == z:
list.append(y)
z_pos += 1
y_pos += 1
print(list[n])
return list[n]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment