modulusplot.py

Created by ews31415

Created on May 30, 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))