N = 1
R = 2
M = 1
Pnum = 10

a = [0] * Pnum
a[0] = 1
# a[1] = 1


#####
# integrators
#####
intAcc0 = [0] * Pnum
intAcc1 = [0] * Pnum
intAcc2 = [0] * Pnum

for i in range(Pnum):
    intAcc0[i] = intAcc0[i-1] + a[i]
    intAcc1[i] = intAcc1[i-1] + intAcc0[i]
    intAcc2[i] = intAcc2[i-1] + intAcc1[i]

#####
# decimator
#####

decimSignal = intAcc2[::R]
decimPnum = int(Pnum/R)
#####
# comb sections
#####
combSum0 = [0] * decimPnum
combSum1 = [0] * decimPnum
combSum2 = [0] * decimPnum

for i in range(decimPnum):
    if i == 0:
        combSum0[i] = decimSignal[i] - 0
        combSum1[i] = combSum0[i] - 0
        combSum2[i] = combSum1[i] - 0
    else:
        combSum0[i] = decimSignal[i] - decimSignal[i-1]
        combSum1[i] = combSum0[i] - combSum0[i-1]
        combSum2[i] = combSum1[i] - combSum1[i-1]


print(a)
print(intAcc0)
print(intAcc1)
print(intAcc2)
print(decimSignal)
print(combSum0)
print(combSum1)
print(combSum2)
