On the periodicity of an arithmetical function