0

I am currently interested in the problem

For an integer $m$, define $f(m)$ as the smallest integer $n$ such that $m \ | \ \overbrace{9999\dots9999}^{n}$

This is a property I observed after messing around with some divisibility tests. Specifically, I wrote this C program:

#include <stdio.h>

int f(int n) {

int t = 9;
int a = 1;
while (t % n != 0) {
    t = ((t * 10) + 9) % n;
    a += 1;
    if (a &gt; 100000) {
        return -1; // break in order to not use too many cycles
    }
}
return a;

}

int main() { freopen("./out.txt", "w", stdout); for (int i = 1; i < 100000; i += 2) { if (i % 5 != 0) { //looping over odd integers so no need to check for i % 2 == 0 int b = f(i); if (i - b == ){ printf("%d\n", i); } // printf("f(%d) = %d\n", i, f(i));

    }
}
return 0;

}

to test if there is an integer $n$ for the conjecture for $n$ up to $10^5$ and $5 \not | \ n$. So far, all the results are positive, so this is why I decide to dive deeper. If you are interested in this problem, here are the values for $n$ and $f(n)$ with $n$ up to $10^5$ separated by a space

Hypothesis: $f(m)$ exists for all odd integer $m$ not divisible by $5$

With this, I decide to dive further into the output.

Sub-hypothesis: There exists infinitely many $m$ such that $f(m) = m - 1$

I extended the program to loop up to $10^5 = 100000$, and I noticed that there are certain values for $n$ that $f(n) = n - 1$ (e.g. $ n = 7$). So I decide to extend the program into finding all such integers, and I found the following integers $n$ up to $10^5$ satisfying the equation. What's interesting is that up to $10^5$, $n = 3$ is the only integer satisfying $f(n) = n - 2$, and there are no $n$ satisfying $f(n) = n - a$ where $a = 3, 4, $ or $5$.

I'd love to get reference material and/or more intuition on this problem. What do you think?

Bill Dubuque
  • 282,220
  • Looks like it's sufficient to prove for prime numbers and for $p^k$, where $k > 1$. The other looks easy. Maybe it's provable by induction and Euler (idk.). – openspace Jun 24 '24 at 07:33

1 Answers1

0

This is such fun material I don't want to spoil the answer for you too quickly so here is a sequence of hints / suggestions for interesting things to investigate, and if you want to learn more I will spoil things at the end. For all of these you should be able to generate lots of numerical evidence to sift through, and this is exactly how Euler and Gauss and all those guys did it.

  1. The condition that $m \mid 10^n - 1$ can be restated as the condition that if you divide $10^n$ by $m$, the remainder is $1$. Write the remainder as $10^n \bmod m$ (the modulo operator). What can you say about the sequence $a_n = 10^n \bmod m$?

  2. The fraction $\frac{1}{m}$ has some eventually repeating decimal expansion. Let $p(m)$ be the period of the repeating part; for example, since $\frac{1}{7} = 0.\overline{142857}$ we have $p(7) = 6$. What can you say about the relationship between $p(m)$ and $f(m)$?

  3. The case that $m$ is prime turns out to be special. Do you notice anything about it?

  4. If $\gcd(m, n) = 1$, the numbers $f(m), f(n)$, and $f(mn)$ turn out to be related. What is that relationship?

  5. What happens if you replace $10$ with an arbitrary positive integer $a$?

Now for the spoilers, in the form of a series of links to Wikipedia articles:

Roughly in order: modular arithmetic, modular exponentiation, Fermat's little theorem, multiplicative order, Euler's totient theorem, repeating decimals, Chinese remainder theorem, Carmichael function, primitive root, Artin's conjecture on primitive roots. Have fun!

Qiaochu Yuan
  • 468,795