Question about terminating decimal divisions by appending digits

20 views
Skip to first unread message

Ali Sada

unread,
Jan 25, 2026, 12:34:16 AMJan 25
to seq...@googlegroups.com

Hi everyone,


 

Hope all is well.

In base 10, when we divide m by n (where is not a multiple of n), the decimal expansion terminates if and only if the prime factors of n are only 2 and/or 5. In these cases, appending zeros during long division is sufficient, and the division will eventually terminate. For such denominators, we define a(n) = 0.

But what if n has prime factors other than 2 and 5? In that case, appending zeros alone will never terminate the division. However, if we repeatedly append a different number instead of zero, the division can terminate.

For example:

  • If n = 3, appending 1 works. ( 1/3à 11/3à 21/3 = 7). So, a(3) = 1.

  • If n = 6, appending 2 works.  (2/6à 22/6à 12/6 = 2 and  5/6à 52/6à 42/6 = 7.) So, a(6) =2. 

  • If n = 11, appending 12 works (1/11à 112/11à 212/11à 312/11à 412/11à 512/11à 612/11à 712/11à 812/11à 912/11 à1012/11 = 92). So, a(11) = 12.

My question is: does this work for all integers n? In other words, for every n, does a number exist that can be repeatedly appended (in base 10) so that the division eventually terminates?


Best,


Ali


h...@crypt.org

unread,
Jan 25, 2026, 7:58:20 AMJan 25
to seq...@googlegroups.com, h...@crypt.org
:My question is: does this work for all integers n? In other words, for
:every n, does a number exist that can be repeatedly appended (in base 10)
:so that the division eventually terminates?

Yes.

The important thing is that the appended string must change the value
modulo each of the relevant prime factors of n each time you append it.

The key involves the same insight as that involved in determining
the period of the repeating part of 1/p (A051626): when p does not
divide 10, it is the smallest number of the form 10^k-1 that divides p
(and such a k will always exist, and be at most p-1).

Let n = xy such that x consists only of powers of 2 and 5, and y contains
no such powers. Then you need to append digits to the same length as
the period of y (or a multiple thereof), ensuring a) that the appended
string is divisible by x, and b) that it is not divisible by y.

Thus "12" works for n=11 because A051626(11) = 2, and 12 == 1 (mod 11).

Also "16" works for n=48 because length(16) is a multiple of A051626(1),
16 == 1 (mod 3) and 16 == 0 (mod 16).

Hugo

Ali Sada <ali....@gmail.com> wrote:
:Hope all is well.
:
:In base 10, when we divide m by n (where is not a multiple of n), the
:decimal expansion terminates if and only if the prime factors of n are only
:2 and/or 5. In these cases, appending zeros during long division is
:sufficient, and the division will eventually terminate. For such
:denominators, we define a(n) =3D 0.
:
:But what if n has prime factors other than 2 and 5? In that case, appending
:zeros alone will never terminate the division. However, if we repeatedly
:append a different number instead of zero, the division *can* terminate.
:
:For example:
:
: -
:
: If n =3D 3, appending 1 works. ( 1/3=C3=A0 11/3=C3=A0 21/3 =3D 7). So, a=
:(3) =3D 1.
: -
:
: If n =3D 6, appending 2 works. (2/6=C3=A0 22/6=C3=A0 12/6 =3D 2 and 5/=
:6=C3=A0 52/6=C3=A0 42/6 =3D
: 7.) So, a(6) =3D2.
: -
:
: If n =3D 11, appending 12 works (1/11=C3=A0 112/11=C3=A0 212/11=C3=A0 31=
:2/11=C3=A0 412/11=C3=A0
: 512/11=C3=A0 612/11=C3=A0 712/11=C3=A0 812/11=C3=A0 912/11 =C3=A01012/11=
: =3D 92). So, a(11) =3D 12.
Reply all
Reply to author
Forward
0 new messages