# Is this function computable?

Given a function like:

f(x) = x=y then 1 else 0

The number y is a natural number, other than that is unknown

I had two approaches in mind:

• The function is computable since an algorithm exists, that can compare two numbers, and tell whether they are equal return 1, otherwise 0.

• The function is not computable, since we would need to know the number y to write an algorithm that compares the numbers.

Can someone give me a hint into the right direction?

• Your question is ambiguous: "we would need to know the number": which one ?
– user16034
Jun 25, 2023 at 14:31
• If $y$ is unknown but natural, then the function $f$ tells if $x$ is natural. But calculability deals with natural numbers, so the function value is always $1$.
– user16034
Jun 25, 2023 at 14:32

A common definition of a computable function $$f(x) : \mathcal{X} \to \mathbb{N}$$ is as follows:
There exists a Turing machine that given $$x\in \mathcal{X}$$ on its initial tape will produce $$f(x)$$ after a finite amount of steps.
Now for your question, we can produce an infinite set of Turing machines by mapping each natural number $$y$$ to a Turing machine that tests if its input $$x$$ equals $$y$$. Each of these Turing machines obviously exists. Since your function $$f$$ is equivalent to one of these Turing machines, it must be computable.