Sujet : Prog Challenge
De : nuxxie (at) *nospam* linux.rocks (Nuxxie)
Groupes : comp.os.linux.advocacyDate : 07. Mar 2024, 20:11:17
Autres entêtes
Organisation : UsenetExpress - www.usenetexpress.com
Message-ID : <17ba8df1ac0783cb$104093$1054558$802601b3@news.usenetexpress.com>
User-Agent : Pan/0.146 (Hic habitat felicitas; d7a48b4 gitlab.gnome.org/GNOME/pan.git)
Programming is about mathematics and not coding.
Problem:
Any rational number a/b (in lowest terms) can be expressed either
as a terminating decimal or a repeating decimal.
We consider here only repeating decimals.
Given, a and b, which are intergers with any number of digits,
find the repeating portion in the decimal expansion.
That is, the decimal expansion will be:
a1, a2, a3, ... an, [r1, r2, r3 ... rn]
where [... ri ...] is the repeating portion.
Example:
1/28 = 0.03 571428 571428...
The non-repeating, leading portion can be very long and so too can
the repeating portion.