## Relationship between prime numbers and repeating digits in rational numbers

Share the projects you're working on! Ask for feedback (if you want!) or just show off! Help others with their works! Collaborate! Make stuff!
Message
Author
ben
Posts: 7
Joined: Fri Mar 11, 2022 11:21 pm

### Relationship between prime numbers and repeating digits in rational numbers Here's a fun game. Find the next three numbers in this sequence:

0 1 0 6 2 6 16 18 22 28 15

(Hint: These numbers are generated from the series of primes.)
► Show Spoiler
Did you guess it right? (How the heck did you figure that out?) I was bored one day and wondered why 1/7 is 0.1428571428571428571... repeating forever. The pattern is 142857, which is 6 digits long.

1/11 is 0.09090909... this time only 2 digits: 0 and 9.

1/13 is 6 digits again.

1/17 is 16 repeating digits. Hmm what is going on? Taking the sequence 1/x = y where x is every prime number and y is the length of the repeating pattern in the decimals, I generated these points.

(2, 0), (3, 1), (5, 0), (7, 6), (11, 2), (13, 6), (17, 16), (19, 18), (23, 22), (29, 28), (31, 15), (37, 3), (41, 5), (43, 21), (47, 46), (53, 13), (59, 58), (61, 60), (67, 33), (71, 35), (73, 8), (79, 13),
(83, 41), (89, 44), (97, 96), (101, 4), (103, 34), (107, 53), (109, 108), (113, 112), (127, 42), (131, 130), (137, 8), (139, 46), (149, 148), (151, 75), (157, 78), (163, 81), (167, 166), (173, 43), (179, 178), (181, 180), (191, 95), (193, 192), (197, 98), (199, 99), (211, 30), (223, 222), (227, 113)

I'm sure I'm not the first person to "discover/invent" this sequence. The most frequent length is x-1. The next most likely is (x-1)/2 etc. as you can see from this graph:  My conjectures are as follows:

1. Any given prime number will always generate a repeating pattern of the same length if it is in the denominator, regardless of what is in the numerator. 2.Decimals resulting from division by a prime number will never have leading digits before the repeating pattern starts. For example 1/12 will be 0.083333. 3 repeats forever. The leading digits are 0 and 8, because 12 is not prime.

3.Fractions will never have repeating patterns longer than the largest prime factor of the denominator - 1.

4. Any whole number in the denominator will generate the same length repeating pattern as its largest prime factor. (Numbers with the largest prime factor of 3 seem to be an exception.)

Let's take some random number 245 / 627. Ignore the top number. 627's largest prime factor is 19. 1/19 has a repeating pattern of 18 digits. So n / 627 should always have a repeating pattern of 18 digits. Lets see... 0.0015948963317384370015948963317384370015948963317384370015948963

Yup! The repeating pattern is 001594896331738437. That's 18 digits! I'm sure this is already known, but I think it's pretty neat if true. Is this interesting at all? Can you find any counter-examples? Do you notice any patterns? Can you think of anywhere in real life where this might be useful? What else should I try? Do you know why numbers be like they are? Do you want more math posts?
Post your thoughts below. Tags:

uhpkkim
Posts: 95
Joined: Fri Dec 10, 2021 7:16 pm
Name 2: PK
Pronouns: they/them
Contact: woah this is neat! I stopped understanding towards the end but this is exactly the type of wizard brain shit i love ben
Posts: 7
Joined: Fri Mar 11, 2022 11:21 pm
Literally 2 days after I posted this, Numberphile did a video on it. uhpkkim
Posts: 95
Joined: Fri Dec 10, 2021 7:16 pm
Name 2: PK
Pronouns: they/them
Contact:
Ain't that just the way.

That dude Shanks was very dedicated to sittin and diggin around with numbers for a long time. I'm here for it