Skip to main content

Determination of R(p)

If p is odd, the remainders

           0
mod(2 ,p)
1
mod(2 ,p)

.
.
.
                                                               t

will be between 1 and p-1 inclusive. At some power of 2, say 2 , there

                                                       k    t

will be a repeated remainder, so that for some k < t, 2 = 2 mod p.

       t+1    k+1
Since 2 = 2 mod p
t+2 k+2
and 2 = 2 mod p

.
.
.
etc.
                                          0    t-1

all of the distinct remainders occur for 2 ...2 . Therefore, R(p)=t.

Next we show that

      R(p)
2 = 1 mod p
                      R(p)    k

We already know that 2 = 2 mod p

for some 0<=k<R(p). Let j=R(p)-k so 0<j<=R(p). Then

      k+j           k
2 = 2 mod p
j k k
or 2 *2 = 2 mod p
j k
or (2 -1)*2 = 0 mod p
                       k                                     j

Now p does not divide 2 because p is odd, so p must divide 2 -1. Thus

       j
2 -1 = 0 mod p
j
2 = 1 mod p

Since j is greater than 0 by hypothesis and since ther is no k other than 0 less than R(p) such that

       k    0
2 = 2 mod p,
                         R(p)

we must have j=R(p), or 2 = 1 mod p.

                                                       k

We have thus shown that for odd p, the remainders mod(2 ,p) are unique for k = 0, 1,..., R(p)-1 and then repeat exactly, beginning with

       R(p)
2 = 1 mod p.

We now consider even p. Let

              q
p = p'*2 ,
                                k                     k          k

where p' is odd. For k<q, mod(2 ,p) is clearly just 2 because 2 <p.

For k>=q,

          k       q      k-q
mod(2 ,p) = 2 *mod(2 ,p').

From this we can see that the sequence of remainders will have an

                             q-1

initial segment of 1, 2, ...2 of length q, and repeating segments of length R(p'). Therefore, R(p) = q+R(p'). Since we normally expect

     R(p) ~ p,

even p generally will not be useful.

I don't know of a direct way of choosing a p for a given n, but the previous table was generated from the following Fortran program run under the SEX system at UCLA.

            0
CALL IASSGN('OC ',56)
1 FORMAT(I3,I5)
M=0
DO 100 K=1,100,2
K=1
L=0
20 L=L+1
N=MOD(2*N,K)
IF(N.GT.1) GO TO 20
IF(L.LE.M) GO TO 100
M=L
WRITE(56,1)K,L
100 CONTINUE
STOP
END

Fortran program to computer useful divisors

In the program, K takes on trial values of p, N takes on the values of the successive remainders, L counts up to R(p), and M remembers the previous largest R(p). Execution is quite speedy.