21 lines
380 B
Python
21 lines
380 B
Python
from binseq import REAL
|
|
from math import isqrt # integer sqrt
|
|
|
|
# Theorem 3.1 (2)
|
|
|
|
def one_third(n):
|
|
if n == 1: return "."
|
|
if n % 2 == 0: return "0"
|
|
return "1"
|
|
|
|
|
|
def irrational(n):
|
|
if n == 1: return "."
|
|
if n != isqrt(n) * isqrt(n): return "1"
|
|
return "0"
|
|
|
|
|
|
x = REAL(one_third)
|
|
y = REAL(irrational)
|
|
|
|
print("x: " + x.as_string(50) + "\ny: " + y.as_string(50)) |