f(x) = 1 if x is rational
f(x) = -1 if x is not rational
Edit: in all this excitement, I should've just read to the end of the article
Edit: for the second question, take the function:
f(x) = 0 if: the binary representation of it contains infinite 1s
f(x) = total # 1s in the binary representation of x if: the binary representation has a finite number of 1s
https://mathstodon.xyz/@johncarlosbaez/110035669587643133
f(x) = 1 if x is rational
f(x) = -1 if x is not rational
Edit: in all this excitement, I should've just read to the end of the article
Edit: for the second question, take the function:
f(x) = 0 if: the binary representation of it contains infinite 1s
f(x) = total # 1s in the binary representation of x if: the binary representation has a finite number of 1s