modulusplot.py

Created by ews31415

Created on May 29, 2020

310 Bytes

Generate a pixel plot of the equation (x^n + y^n) mod m


from math import *
from kandinsky import *
print("EWS 2020-05-28")
print("x**n + y**n mod m")
n=float(input("power? "))
m=float(input("modulus? "))

for x in range(320):
  for y in range(240):
    t=fmod(pow(x,n)+pow(y,n),m)  
    c=floor(t/m*255)
    set_pixel(x+1,y+1,color(c,c,c))

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 cookies policy.