## Orlando Presentation

### Carousel Numbers: A Lead-in to Number Theory

#### Gary Klatt

```--------------------------------------------------------------------------
2.     PERIODS OF DECIMALS  (the real problem)
--------------------------------------------------------------------------

Most math students know the decimal for any rational
number, m/n, will repeat. For example,

1/7 = .142857142857...              repeats with a period of 6, and

5/12 = .41666...                    repeats with a period of 1 after a
delay of 2.
1/13 = .076923...                   has period 6, half the max of 12

1/17 = .05882352941887647...        has period 16 (the max it could have)

RELATIONSHIP WITH CAROUSEL NUMBERS

As hinted above with 1/7 and 1/17, every n where 1/n
has maximal period n-1 will produce a carousel number.

Only prime n's work and only some primes at that: 7, 17,
19, 23, and 29 are the first five.

We call these CAROUSEL PRIMES.

Our main interest in the algebra/number theory course has been
investigating what determines the period of decimals.

This begins with long division done by hand, but quickly
leads to writing computer programs to generate data and
check out conjectures. Lots of questions yield to easy
conjecture, but surprisingly no one knows the complete
story.

It is too big a story to detail in this short talk, but here is
one small part. We look at period of 1/p for prime p's.

prime,p        p-1    per(1/p)    (p-1)/per(1/p)
-------        ---    --------     ------------
3            2       1              2
7            6       6              1
11           10       2              5
13           12       6              2
17           16      16              1
19           18      18              1
23           22      22              1
29           28      28              1
31           30      15              2
37           36       3             12

The conjecture that per(1/p) divides p-1 is later proved to
be a consequence of Lagrange's theorem in group theory.
(Which says the order of a subgroup divides the order of the group.)

A similar "obvious" conjecture for per(1/p^a) turns out to
be false - the first counterexample is for 1/487^2  (reference 1).

USING THE COMPUTER

Here is a program written in QBASIC to look for primes and then find the
period of 1/p. It also shows (p-1)/per(1/p).

'per(1/p).bas   a program to find the period of the decimal for 1/p
'             (first find the primes, p, up to maxn)

maxn = 289              'how far we will look for primes

'first find the primes less than maxn by the sieve of Eritosthenes

DIM n(maxn): n(1) = 0
FOR j = 2 TO maxn: n(j) = 1: NEXT j: j = 1
DO WHILE j * j < maxn
j = j + 1
IF n(j) = 1 THEN
FOR k = 2 TO maxn / j: n(k * j) = 0: NEXT k
END IF
LOOP

'now print out the primes and the period of 1/p

numbase = 10: j = 2: m = 1
PRINT "prime"; TAB(8); "per(1/p)"; TAB(18); "(p-1)/per"
DO WHILE j < maxn
IF n(j) > 1 AND numbase MOD j > 0 THEN
remainder = 1
place = 0
DO
place = place + 1
remainder = numbase * remainder MOD j
LOOP UNTIL remainder = 1
PRINT TAB(2); j; TAB(10); place; TAB(18);
FOR k = 1 TO (j - 1) / place: PRINT "*"; : NEXT k: PRINT
m = m + 1
END IF
j = j + 1
LOOP

SOME QUESTIONS
For which n's is the decimal for 1/n terminating?
(Find all the simple cases you can. What
determines the length of the decimal?)
What determines when there is a delay? What determines
the length of the delay?  (Relate to the question above.)

How does per(1/p^a) relate to per(1/p)?
(Try small primes but 2 and 5 are special.)
How does per(1/pq) relate to per(1/p), per(1/q)?
(Try 1/707. Note per(1/7)=6, per(1/101)=4.)
How would you modify the program to just find per(1/n)?

```