Finite magmas representing all unary functions by terms Say that a magma $\mathcal{M}=(M;*)$ is unary-rich iff for every function $f:M\rightarrow M$ there is a (one-variable, parameter-free) term $t_f$ such that $t_f^\mathcal{M}=f$. For example:

*

*The one-element magma (and the empty magma if we permit such) is trivially unary-rich.


*A bit less trivially, there is a two-element unary-rich magma (in fact exactly 0ne up to isomorphism): namely $M=\{a,b\}$ and $*$ given by $$a*a=b, a*b=a, b*a=a, b*b=b$$ via the terms, $x, xx, (xx)x,$ and $(xx)(xx)$.
My question is:

Are there unary-rich magmas of every (or at least arbitrarily large) finite cardinality?

Of course every unary-rich magma is finite since there are only countably many terms. Note that if $\vert M\vert=n<\omega$ then $M$ is unary-rich iff $M$ has $n^n$-many distinct one-variable terms up to equality-as-functions.
Already the case of $3$-element magmas seems interesting and difficult to brute-force.
 A: From this answer by Eran, we know that the asymptotic proportion of primal magmas among all magmas is $1/e$.
In a primal algebra all operations defined on its carrier set are terms of the algebra, so certainly every primal magma is unary-rich, and it follows that the asymptotic proportion of unary-rich magmas is equal or greater than $1/e$.
In particular, there have to be arbitrarily large ones.
It may however be the case that is not one of every cardinality.

Added.
From the book "Universal Algebra and Applications in Theoretical Computer Science", by Klaus Denecke and Shelly Wismath, I've got the following results.

Proposition 10.5.7
(i) Let $\mathbf A$ be a primal algebra. Then

*

*$\mathbf A$ has no proper subalgebras,

*$\mathbf A$ has no non-identical automorphisms,

*$\mathbf A$ is simple, and

*$\mathbf A$ generates an arithmetical variety.

(ii) Every functional complete algebra is simple

and then

Theorem 10.5.8
For a finite algebra $\mathbf A$ the following propositions are equivalent:

*

*$\mathbf A$ is primal.

*$\mathbf A$ generates an arithmetical variety, has no non-identical automorphisms, has no proper subalgebras and is simple.

*There is a ternary discriminator term which induces a term operation on $\mathbf A$, and the algebra $\mathbf A$ has no proper subalgebras and no non-identical automorphisms.


Here a ternary discriminator term is an operation $t:A^3\to A$ defined by
$$t(x,y,z) =
\begin{cases}
z &\text{ if } x=y,\\
x &\text{otherwise,}
\end{cases}
$$
and a variety is arithmetical iff it is both congruence-distributive and congruence-permutable.
A: The following is an example of a unary rich magma on $3$ elements I think, the multiplication table is the following:
$\begin{pmatrix}
1 0 0\\
0 2 0 \\
1 0 0 
\end{pmatrix}$
The terms found for each function are as follows:
$ 0\rightarrow 0 \quad 1\rightarrow 0 \quad 2\rightarrow 0 $
$((xx)x)$
$ 0\rightarrow 0 \quad 1\rightarrow 0 \quad 2\rightarrow 1 $
$(x(xx))$
$ 0\rightarrow 0 \quad 1\rightarrow 0 \quad 2\rightarrow 2 $
$((x(xx))(((xx)x)((xx)x)))$
$ 0\rightarrow 0 \quad 1\rightarrow 1 \quad 2\rightarrow 0 $
$((xx)(x(xx)))$
$ 0\rightarrow 0 \quad 1\rightarrow 1 \quad 2\rightarrow 1 $
$((xx)((xx)x))$
$ 0\rightarrow 0 \quad 1\rightarrow 1 \quad 2\rightarrow 2 $
$x$
$ 0\rightarrow 0 \quad 1\rightarrow 2 \quad 2\rightarrow 0 $
$(x((x(xx))(x(xx))))$
$ 0\rightarrow 0 \quad 1\rightarrow 2 \quad 2\rightarrow 1 $
$(x((x(xx))((xx)x)))$
$ 0\rightarrow 0 \quad 1\rightarrow 2 \quad 2\rightarrow 2 $
$(((xx)((xx)x))(((xx)x)((xx)x)))$
$ 0\rightarrow 1 \quad 1\rightarrow 0 \quad 2\rightarrow 0 $
$(x(x(xx)))$
$ 0\rightarrow 1 \quad 1\rightarrow 0 \quad 2\rightarrow 1 $
$(x((xx)x))$
$ 0\rightarrow 1 \quad 1\rightarrow 0 \quad 2\rightarrow 2 $
$((x(xx))((xx)((xx)x)))$
$ 0\rightarrow 1 \quad 1\rightarrow 1 \quad 2\rightarrow 0 $
$((x(xx))((xx)x))$
$ 0\rightarrow 1 \quad 1\rightarrow 1 \quad 2\rightarrow 1 $
$(((xx)x)((xx)x))$
$ 0\rightarrow 1 \quad 1\rightarrow 1 \quad 2\rightarrow 2 $
$((x(xx))(x(xx)))$
$ 0\rightarrow 1 \quad 1\rightarrow 2 \quad 2\rightarrow 0 $
$(xx)$
$ 0\rightarrow 1 \quad 1\rightarrow 2 \quad 2\rightarrow 1 $
$(x((xx)(x(xx))))$
$ 0\rightarrow 1 \quad 1\rightarrow 2 \quad 2\rightarrow 2 $
$(((xx)((xx)x))((xx)((xx)x)))$
$ 0\rightarrow 2 \quad 1\rightarrow 0 \quad 2\rightarrow 0 $
$((xx)((x(xx))(x(xx))))$
$ 0\rightarrow 2 \quad 1\rightarrow 0 \quad 2\rightarrow 1 $
$((xx)(xx))$
$ 0\rightarrow 2 \quad 1\rightarrow 0 \quad 2\rightarrow 2 $
$((x((xx)x))(((xx)x)((xx)x)))$
$ 0\rightarrow 2 \quad 1\rightarrow 1 \quad 2\rightarrow 0 $
$((xx)(x((xx)x)))$
$ 0\rightarrow 2 \quad 1\rightarrow 1 \quad 2\rightarrow 1 $
$((xx)(x(x(xx))))$
$ 0\rightarrow 2 \quad 1\rightarrow 1 \quad 2\rightarrow 2 $
$((x((xx)x))(x((xx)x)))$
$ 0\rightarrow 2 \quad 1\rightarrow 2 \quad 2\rightarrow 0 $
$(((x(xx))(x(xx)))((x(xx))(x(xx))))$
$ 0\rightarrow 2 \quad 1\rightarrow 2 \quad 2\rightarrow 1 $
$(((x(xx))(x(xx)))((x(xx))((xx)x)))$
$ 0\rightarrow 2 \quad 1\rightarrow 2 \quad 2\rightarrow 2 $
$((((xx)x)((xx)x))(((xx)x)((xx)x)))$
I found $1596$ different ones by only checking a small set of terms and going over all the $3^9$ magmas on $0,1,2$.
A: G. Rousseau, Completeness in finite algebras with a single operation, Proc. Amer. Math. Soc. 18 (1967) 1009-1013
This paper proves that a finite algebra with one $n$-ary operation, $n>1$, is primal iff it has no proper subalgebra, no non-identity automorphism, and no proper nontrivial congruence. Therefore the following are equivalent for a finite algebra with one binary operation:

* $\bf A$ is unary-rich.

* $\bf A$ is primal.

* $\bf A$ has no proper subalgebra, no non-identity automorphism, and no proper nontrivial congruence.
