Skip to content

Instantly share code, notes, and snippets.

@njanirudh
Created May 17, 2019 12:21
Show Gist options
  • Save njanirudh/cfaba5a99b467b932ea63f5bf92402f0 to your computer and use it in GitHub Desktop.
Save njanirudh/cfaba5a99b467b932ea63f5bf92402f0 to your computer and use it in GitHub Desktop.
#----- XOR Patterns --------
# https://www.reddit.com/r/math/comments/bpfq1w/weird_prime_pattern/
# https://medium.com/biffures/part-2-the-beauty-of-bitwise-and-or-cdf1d8d87891
import numpy as np
import cv2 as cv2
# Width and height of the image
width = 1000
height = 1000
for xor_count in range(1,150,1):
# Create a blank array of all 'zeros'
image = np.zeros((width, height))
for i in range(width):
for j in range(height):
if ((i^j) % xor_count) == 0:
image[i][j] = 1
cv2.imshow("Xor",image)
cv2.waitKey(200)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment