python script:
#!/usr/bin/python
mtn=[]
l=[]
def printSeq(n):
global l
l = range(1,n+1)
length = len(l)
global mtn
mtn = [str(x)+"->"+str(x+1) for x in l if x<l[-1]]
for x in mtn:
print x
for x in range(2, length):
print "" # empty line
for e in range(length):
if e+x< length:
generateOtherSeq(l[e:x+e+1])
def generateOtherSeq(myl):
for i in range(len(myl)):
ll = list(myl)
if i+1 < len(myl):
ll = mtn[l.index(myl)]
ll.remove(ll[i+1])
print ",".join([str(x) for x in ll])
printSeq(5)
you can change the last line "5" to any number you like. for example "7" will give you this output:
kent$ python pyseq.py
1->2
2->3
3->4
4->5
5->6
6->7
1->2,3
1,2->3
2->3,4
2,3->4
3->4,5
3,4->5
4->5,6
4,5->6
5->6,7
5,6->7
1->2,3,4
1,2->3,4
1,2,3->4
2->3,4,5
2,3->4,5
2,3,4->5
3->4,5,6
3,4->5,6
3,4,5->6
4->5,6,7
4,5->6,7
4,5,6->7
1->2,3,4,5
1,2->3,4,5
1,2,3->4,5
1,2,3,4->5
2->3,4,5,6
2,3->4,5,6
2,3,4->5,6
2,3,4,5->6
3->4,5,6,7
3,4->5,6,7
3,4,5->6,7
3,4,5,6->7
1->2,3,4,5,6
1,2->3,4,5,6
1,2,3->4,5,6
1,2,3,4->5,6
1,2,3,4,5->6
2->3,4,5,6,7
2,3->4,5,6,7
2,3,4->5,6,7
2,3,4,5->6,7
2,3,4,5,6->7
1->2,3,4,5,6,7
1,2->3,4,5,6,7
1,2,3->4,5,6,7
1,2,3,4->5,6,7
1,2,3,4,5->6,7
1,2,3,4,5,6->7