1

Let $q = \frac ab$ be any rational number such that $a < b$. What is the smallest positive integer $n$ such that $\frac ab \times \left(2^n-1\right)$ is an integer?

jII
  • 3,050
  • 1
    By definition, that the order of $2$ $ \pmod b$. Note that if $b$ is even, then there is no such $n$. – lulu Jun 16 '19 at 13:37
  • 1
    If $a,b$ have no common divisor, then search for the smallest $n$ s.t. $b$ divides $2^n-1$. – Wuestenfux Jun 16 '19 at 13:40
  • Is there an expression that might (approximately) relate $n$ to $b$? – jII Jun 16 '19 at 13:45
  • 1
    There is no easy way to compute $n$, unfortunately. General theory tells us that $n$ is a divisor of $\varphi(b)$, where $\varphi$ denotes Euler's totient function In particular, $\varphi(b)$ always works as an exponent $n$, but it won't, in general, be minimal. – lulu Jun 16 '19 at 13:48
  • Is there a particular reason for the binary tag? Are you trying to write a program for this? – Simply Beautiful Art Jun 16 '19 at 14:03
  • @SimplyBeautifulArt Re: binary, see the first sentence in my answer. – Bill Dubuque Jun 16 '19 at 14:55
  • I'm not particularly interested in a small tangent in an answer. I'm asking the OP what interest they have in putting up the binary tag, since it may affect answers. – Simply Beautiful Art Jun 16 '19 at 15:01
  • @SimplyBeautifulArt Yuur response is quite puzzling. Do you seriously think that the reaosn is other than I have explained? If so please do explain since that would be rather surprising. Btw, you need to use "user" if you wish the user to be notified of your reply (I noticed it only by chance). – Bill Dubuque Jun 16 '19 at 15:16
  • I'm not saying it probably isn't, but I'm not going to assume the reasoning behind the OP's tagging. That is why I am asking them. Also for some reason mobile is being buggy for me on the @. – Simply Beautiful Art Jun 16 '19 at 15:20
  • 1
    @Sim But it seemed you were by calling the question's raison d'etre a "small tangent" . That's why I was puzzled by your remark. – Bill Dubuque Jun 16 '19 at 15:26
  • The majority of your answer is not specific to binary, hence my remark. – Simply Beautiful Art Jun 16 '19 at 15:29
  • 2
    @SimplyBeautifulArt and Bill Dubuque, thanks for the responses---I used the "binary" tag when posting the question for the same connection identified in Bill's answer. – jII Jun 16 '19 at 16:42

1 Answers1

3

It's simply the binary analog of computing the decimal period of a fraction.

W.l.o.g. generality we may assume that $\,a/b\,$ is reduced, i.e. $\,d = \gcd(a,b) = 1\ $ (else cancel $d).$

Then $\, (2^{\large n}-1)a/b = k\in\Bbb Z\iff bk = (2^{\large n}-1)a\ $ so $\,b\mid a(2^{\large n}-1).\,$ Since $\,\gcd(b,a) = 1\,$ we infer by Euclid's Lemma that $\,b\mid 2^{\large n}-1,\,$ i.e. $\,2^{\large n}\equiv 1\pmod{\!b}.\,$

Since $\,2^{\large n}-1\,$ is odd its factor $b$ must be odd, and it is easy to show that such an $n$ must exist, e.g. by a pigeonhole argument, or by Euler's phi theorem (or Lagrange) we can choose $\,n = \phi(b).$

The least such $\,n > 0\,$ is known as the order of $\,2\,$ modulo $\,b.\,$ It can be verified using the Order Test and computed by various algorithms.

Bill Dubuque
  • 272,048