# Decimal Expansion Buddies

**Number Theory**Level 5

\[\frac{1}{271}=0.0036900369...\]

\[\frac{1}{369}=0.0027100271...\]

If the decimal expansion of \(\frac{1}{a}\) can be written as a string of \(5\) digits repeated over and over ad infinitum, where the rightmost digits of the string form the number \(b\) and any leading digits are \(0\)'s, (as per the example), then \(a\) and \(b\) are considered *decimal expansion buddies*.

How many distinct pairs of decimal expansion buddies are there?

**Note:** \((a,b)\) and \((b,a)\) are considered to be the same pair of numbers, and therefore are only counted once.

**Bonus:** Can you generalize this for any period length?