Skip to content
TopicTracker
From johndcook.comView original
TranslationTranslation

When will the decimals in a/b repeat?

The article revisits the topic of the period length of repeating decimals in fractions a/b, following a previous post on harmonic numbers. It explains how to determine the cycle length of decimal digits and provides code to compute it.

Background

John D. Cook is a mathematician and longtime blogger who writes accessible explanations of applied math, statistics, and programming. This post is about properties of *repeating decimal expansions* — the infinite tails that appear when you divide one integer by another (e.g., 1/3 = 0.333…, 1/7 = 0.142857142857…). The main result cited: the length of the repeating cycle (the "period") of a/b is determined by the multiplicative order of 10 modulo the denominator's factors that are coprime to 10. The post includes code (in Python/Sage) to compute period lengths. The "harmonic numbers" mentioned (H_n = 1 + 1/2 + … + 1/n) were the subject of his previous post; he is curious how long their decimal expansions repeat, which is a niche but nontrivial number-theory question.

Related stories

  • The article explains a mathematical method for determining when the decimal representation of a fraction A/B will repeat, focusing on the relationship between the denominator's prime factors and the repeating period length.