Problem

Source:

Tags: Miscellaneous Problems



Denote by $S$ the set of all primes $p$ such that the decimal representation of $\frac{1}{p}$ has the fundamental period of divisible by $3$. For every $p \in S$ such that $\frac{1}{p}$ has the fundamental period $3r$ one may write \[\frac{1}{p}= 0.a_{1}a_{2}\cdots a_{3r}a_{1}a_{2}\cdots a_{3r}\cdots,\] where $r=r(p)$. For every $p \in S$ and every integer $k \ge 1$ define \[f(k, p)=a_{k}+a_{k+r(p)}+a_{k+2r(p)}.\] Prove that $S$ is finite. Find the highest value of $f(k, p)$ for $k \ge 1$ and $p \in S$.