Skip to content

Instantly share code, notes, and snippets.

@scholtes
Created August 20, 2020 01:36
Show Gist options
  • Save scholtes/fc1f4a6b1908c90c8278a54973c17f51 to your computer and use it in GitHub Desktop.
Save scholtes/fc1f4a6b1908c90c8278a54973c17f51 to your computer and use it in GitHub Desktop.
from sympy import prime
from math import tan, pi
from random import random
def chug_primes():
max = 0
for i in range(1,1000000000000):
p = prime(i)
v = tan(p)/p
if v > max:
max = v
print(f"{i}: {p} <-> {v}")
def chug_integers():
max = 0
for i in range(1,1000000000000):
v = tan(i)/i
if v > max:
max = v
print(f"{i}: {i} <-> {v}")
def chug_randoms():
max = 0
for i in range(1,1000000000000):
r = random()*pi/2
v = tan(r)/i
if v > max:
max = v
print(f"{i}: {r} <-> {v}")
# Pick one:
chug_primes()
# chug_integers()
# chug_randoms()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment