2

More Precisely I am trying to solve https://www.hackerrank.com/challenges/special-multiple/problem problem. I know its programming solution to generate binary strings and check that combination works or not. But I want to know if some mathematical solution exists which can solve this problem. without exhaustively checking all the possibilities

  • Hint: if $\gcd(n,10)=1$ then $n,|,10^{\varphi(n)}-1$. – lulu May 04 '20 at 15:49
  • 1
    @lulu I suspect that your hint only gives existence, but not "smallest integer". – Calvin Lin May 04 '20 at 15:54
  • @CalvinLin Oh, you are right. Missed that condition. – lulu May 04 '20 at 15:55
  • My belief is that we essentially have to test out all cases. We could simplify the work some by calculating $10^i \pmod{N}$, but it's essentially writing a program to check all terms (and the math theory tells us that a correctly run program will eventually terminate) – Calvin Lin May 04 '20 at 15:57
  • 2
    The problem using only $0$ and $1$ is clearly related. See, e.g., this. – lulu May 04 '20 at 16:17
  • 1
    @lulu Essentially the problem using $0$ and $1$ is equivalent. If $n$ is coprime to $3$, $n \mid 9 y$ iff $n \mid y$. If $n$ is divisible by $3$ but not $9$, $n \mid 9 y$ iff $n/3 \mid 3 y$ iff $n/3 \mid y$. If $n$ is divisible by $9$, $n \mid 9 y$ iff $n/9 \mid y$. – Robert Israel May 04 '20 at 16:21
  • @RobertIsrael Ah, yes. Good point. – lulu May 04 '20 at 16:23

0 Answers0