Continuous function that outputs even and odd numbers from natural inputs in a non-constant, non-alternating order

elementary-number-theoryparityspecial functions

For example, plugging 1, 2, 3, 4 into this function would produce results which are even, odd, odd, even, and that pattern would repeat. Is this possible for a continuous function? Can you make any arbitrary pattern of odds and evens as outputs of natural numbers with a continuous function?

Best Answer

Yes, it is.

Consider the set $\Bbb N$ or natural numbers and whatever "pattern" $(p_n)_{n \in \Bbb N}$ you want. Define $f(n)=p_n$ and then interpolate linearly in $[n, n + 1].$ Make $f$ constant until the first natural.