Show $f$ is primitive recursive, where $f(n) = 1$ if the decimal expansion of $\pi$ contains $n$ consecutive $5$'s Let $f:\mathbb{N}\to\mathbb{N}$ be given by $f(n)=1$ if the decimal expansion of $\pi$ contains $n$ consecutive $5$'s, and $f(n)=0$ otherwise.
How would you go about showing such a function is primitive recursive? 
I suppose you should be able to construct it out of other p.r. functions, via composition or the basic recursion scheme that the family of p.r. functions is closed under (I don't know if such an algorithm has a name).  However, I do not know how to deal with the decimal expansion of anything (much less an irrational) as something that would come from p.r. functions.  Particularly because if it's irrational, you'd have to express it as an infinite series (i.e. an infinite number of sums).
 A: It's a trick question -- it is easy to show that your function must have a primitive recursive definition, but very hard to say with certainty what that primitive recursive definition is.
Either the decimal expansion of $\pi$ contains arbitrary long sequences of consecutive 5's, and in that case $f(n)$ is the function that always returns $1$. That is obviously primitive recursive. --
Or the decimal expansion of $\pi$ contains $N$ consecutive 5's somewhere, but never contains $N+1$ consecutive 5's, for some finite $N$. In that case
$$ f(n)=\begin{cases}1 & \text{if }n\le N \\ 0\ &\text{otherwise} \end{cases}$$
which is also obviously primitive recursive.
The lesson to take home is that "is primitive recursive" is a property only on the contents of the abstract set $\{(x,y)\mid f(x)=y\}$, and does not depend on how you describe or define that contents.

If this feels too fuzzy, consider this simpler example: Define the number $K$ to be $42$ if the Riemann Hypothesis is true and $57$ otherwise. It is extremely difficult to prove stuff about $K$ explicitly, but we can say with absolute certainty that it's an integer, is less than $100$ and is not a perfect square. To prove these things we don't need to know whether RH is true; it suffices to show that no matter whether it is or not, the property we're after will be true. It's the same with "is a primitive recursive function".
