#
# PYTHON • MyCompiler
# https://[Log in to view URL]
# Teoria das Partições
# Estudo Fórmula Pentagonal de Euler
#
# 2026 Abril Dom, 26
# by
# j
#
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
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 prod(x):
max = 700
p = 1
for m in range(1,max+1):
p = p*(1/(1-x**m))
return p
def sum(x):
max = 100
s = 0
for n in range(0,max+1):
s += euler(n)*x**n
return s
def list():
x = []
y = []
z = []
delta = 0.01
xstart = 0.1
xend = 0.7
xk = xstart
while (xk < xend):
yk = prod(xk)
zk = sum(xk)
x.append(xk)
y.append(yk)
z.append(zk)
xk = xk + delta
plt.plot(x, y, marker='o', linestyle='-', color='b', label='prod(x)')
plt.plot(x, z, marker='o', linestyle='-', color='r', label='sum(x)')
plt.title("Pentagonal Euler")
plt.xlabel("x")
plt.ylabel("prod(x),sum(x)")
plt.legend()
plt.grid(True)
plt.show()
list()
To embed this project on your website, copy the following code and paste it into your website's HTML: