# Guelah Papyrus

If you plot

$$\Huge{\frac{1}{2}<\left\lfloor{{\rm mod}\left({\left\lfloor\frac{y}{17}\right\rfloor2^{-17\lfloor{x}\rfloor-\left({\rm mod}(\lfloor{y}\rfloor,17\right)}},2\right)}\right\rfloor}$$,

you get

where

\LARGE{\begin{alignat}{1} k = 4\ & 858\ 450\ 636\ 189\ 713\ 423\ 582\ 095\ 962\ 494\ 202\\ & 044\ 581\ 400\ 587\ 983\ 244\ 549\ 483\ 093\ 085\ 061\\ & 934\ 704\ 708\ 809\ 928\ 450\ 644\ 769\ 865\ 524\ 364\\ & 849\ 997\ 247\ 024\ 915\ 119\ 110\ 411\ 605\ 739\ 177\\ & 407\ 856\ 919\ 754\ 326\ 571\ 855\ 442\ 057\ 210\ 445\\ & 735\ 883\ 681\ 829\ 823\ 754\ 139\ 634\ 338\ 225\ 199\\ & 452\ 191\ 651\ 284\ 348\ 332\ 905\ 131\ 193\ 199\ 953\\ & 502\ 413\ 758\ 765\ 239\ 264\ 874\ 613\ 394\ 906\ 870\\ & 130\ 562\ 295\ 813\ 219\ 481\ 113\ 685\ 339\ 535\ 565\\ & 290\ 850\ 023\ 875\ 092\ 856\ 892\ 694\ 555\ 974\ 281\\ & 546\ 386\ 510\ 730\ 049\ 106\ 723\ 058\ 933\ 586\ 052\\ & 544\ 096\ 664\ 351\ 265\ 349\ 363\ 643\ 957\ 125\ 565\\ & 695\ 936\ 815\ 184\ 334\ 857\ 605\ 266\ 940\ 161\ 251\\ & 266\ 951\ 421\ 550\ 539\ 554\ 519\ 153\ 785\ 457\ 525\\ & 756\ 590\ 740\ 540\ 157\ 929\ 001\ 765\ 967\ 965\ 480\\ & 064\ 427\ 829\ 131\ 488\ 548\ 259\ 914\ 721\ 248\ 506\\ & 352\ 686\ 630\ 476\ 300\end{alignat}}

Also,

$$\Huge{e\approx\left(1+9^{-4^{6\times7}}\right)^{3^{2^{85}}}}$$

It’s accurate to $$\LARGE{\left\lfloor\log_{10}\left(3^{2^{85}}\right)+1\right\rfloor=18\ 457\ 734\ 525\ 360\ 901\ 453\ 873\ 570}$$ digits!

Lastly (though I have mentioned this before),

$$\Huge{\sum_{n=1}^{\infty}{n}=1+2+3+4+\cdots=-\frac{1}{12}}$$

as explained here and here and here.

# Custard Pie

Happy π Day!

## Pi
##
## Algorithms for calculating the value of Pi
## Written (mostly) on Pi Day 2017

import random
import math
import decimal

precision = 50

D = decimal.Decimal
decimal.setcontext(decimal.Context(prec = precision))

def pi_by_random_numbers(max_number, trials, print_every=10000):
i = 1
cp = 0
while i < trials:
a, b = random.randint(1, max_number), random.randint(1, max_number)
if math.gcd(a, b) == 1: # if random numbers are coprime
cp += 1 # increment coprime counter
i += 1 #increment loop counter
if (i % print_every) == 0:
print((D(6*i)/D(cp)).sqrt())
return (D(6*i)/D(cp)).sqrt()

def pi_by_riemann_zeta(terms, print_every=10000):
i = 1
zsum = D(0)
while i < terms:
zsum += D(1)/(D(i)*D(i))
if (i % print_every) == 0:
print((zsum*D(6)).sqrt())
i += 1
return (zsum*D(6)).sqrt()

def pi_by_bbp(from_digit,to_digit=None):
if to_digit is None or from_digit<0:
from_digit,to_digit=0,abs(from_digit)
if not isinstance(from_digit,int) or from_digit<0:
from_digit=int(abs(from_digit))
if not isinstance(to_digit,int) or to_digit<0:
to_digit=int(abs(to_digit))
def pi_gen():
try:
N = 0
n, d = 0, 1
while True:
xn = (120 * N * N + 151 * N + 47)
xd = (512 * N * N * N * N + 1024 * N * N * N + 712 * N * N + 194 * N + 15)
n = (16 * n * xd + xn * d) % (d * xd)
d *= xd
yield 16 * n // d
N += 1
except KeyboardInterrupt:
print(N)
raise
pi=pi_gen()
s='3.'
if from_digit==0:
print('3.',end='')
for i in range(from_digit):
d=next(pi)
for i in range(from_digit,to_digit):
d=next(pi)
print('0123456789abcdef'[d],end='')
s+='0123456789abcdef'[d]
print()
return s