#
# PYTHON • MyCompiler
# https://[Log in to view URL]
# Teoria das Partições
# Recorrência Pentagonal de Euler
#
# 2026 Abril Qui, 23 — Dom, 26
# by
# j
# 

def euler(m):
    p = []
    p.append(1)
    p.append(1)
    for n in range(0,m+1):
        flag = True
        k = 1
        sum = 0
        while (flag):
            j = 0
            while ( (j <= 1) and flag):
                exp = (-1)**j
                kk = exp*k
                Gk = int(kk*(3*kk - 1) / 2)
                if ( (n - Gk) >= 0 ):
                    sum += ( (-1)**(kk-1) )*p[n-Gk]
                    j += 1
                else:
                    flag = False
            k += 1
        if (n>=2):
            p.append(int(sum))
    return p[m]

def list(max):
    for j in range(0,max+1):
        print('p['+str(j)+'] =',euler(j))

list(100)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: