Skip to content

Instantly share code, notes, and snippets.

View Eliran-Turgeman's full-sized avatar

Eliran Turgeman Eliran-Turgeman

View GitHub Profile
import matplotlib.pyplot as plt
%matplotlib inline
def collatz(x, b=False):
if x % 2 == 0:
if b:
print(f'{x} is even, {x}/2 = {x/2}')
return x / 2
else:
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
MAX_RANK = 100
FNAME = 'bcollie.jpg'
image = Image.open(FNAME).convert("L")
img_mat = np.asarray(image)
@Eliran-Turgeman
Eliran-Turgeman / steinhaus_cycle.py
Created October 25, 2020 10:42
steinhaus_cycle
def sum_of_squared_digits(n):
digits = [i for i in str(n)]
sum = 0
for digit in digits:
sum += int(digit)**2
return sum
iter = 0
iters = []
import matplotlib.pyplot as plt
%matplotlib inline
from tqdm import trange
def isPalindrome(x):
return str(x) == str(x)[::-1]
def graph_number_to_iterations():
lychrel = [196,295,394,493,592,689,691,788,790,879,887,978,
import sympy
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as ani
plt.style.use('dark_background')
def convert_to_polar_coordinates(num):
return num*np.cos(num), num*np.sin(num)