triplpy.py

Created by christian-mercat

Created on March 22, 2024

366 Bytes

Triplets pythagoriciens, je cherchais en particulier des non multiples de 5; il n’y en a pas, pourquoi?


import cmath
from math import sqrt
L={complex(i,j)**2 for i in range(1,6) for j in range(1,i)}
L=list(map(lambda z: (round(z.real),round(z.imag),round(sqrt(z.real**2+z.imag**2))),L))
print(L)
#L={z for z in L if ((z.real*z.imag) %5 !=0)and((z.real**2+z.imag**2) %5 !=0)}
#L=[1 for i in range(8) for j in range(i,8) for k in range(j,8)]
#print(sum(L))

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.