lth = len(spitches)
intervals = [((spitches[0 if i + 1 >= lth else i + 1] - x) %
    tones_in_octave) for i, x in enumerate(spitches)]
sintervals = sorted(intervals)
p_form = [sum(sintervals[:i]) for i in range(len(intervals))]
print("""({})
this is the prime form!""".format(' '.join(map(str, p_form))))
How to do calculations in lists with *args in Python 3.5.1