It is recommended that a function return something instead of printing it. (And you are still free to print the output after calling the function if that's what you want.)
It is also recommended that the output of a function be consistent, e.g. do not return a number in one case, or a string "Not prime" in another. Here, returning a boolean (TRUE or FALSE for prime or not) is what makes most sense.
It is also recommended (beneficial) to vectorize functions when you can. So you could call the function using a vector like 1:10
and it will quickly return a vector of ten booleans.
Taking all that into account, I would define the function as follows:
is.euler.prime <- function(k) (2^k-2) %% k == 0
Then you can do things like:
is.euler.prime(10)
is.euler.prime(1:10)
which(is.euler.prime(1:10))
data.frame(x = 1:10, euler.prime = is.euler.prime(1:10))