login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A307070
a(n) is the number of decimal places before the decimal expansion of 1/n terminates, or the period of the recurring portion of 1/n if it is recurring.
0
0, 1, 1, 2, 1, 1, 6, 3, 1, 1, 2, 1, 6, 6, 1, 4, 16, 1, 18, 2, 6, 2, 22, 1, 2, 6, 3, 6, 28, 1, 15, 5, 2, 16, 6, 1, 3, 18, 6, 3, 5, 6, 21, 2, 1, 22, 46, 1, 42, 2, 16, 6, 13, 3, 2, 6, 18, 28, 58, 1, 60, 15, 6, 6, 6, 2, 33, 16, 22, 6, 35, 1, 8, 3, 1, 18, 6, 6, 13
OFFSET
1,4
COMMENTS
If the decimal expansion of 1/n terminates, we will write it as ending with infinitely many 0's (rather than 9's). Then for any n > 1, the expansion of 1/n consists of a preamble whose length is given by A051628(n), followed by a periodic part with period length A007732(n). This sequence is defined as follows: If the only primes dividing n are 2 and 5 (see A003592), a(n) = A051628(n), otherwise a(n) = A007732(n) (and the preamble is ignored). - N. J. A. Sloane, Mar 22 2019
This sequence was discovered by a school class (aged 12-13) at Arden School, Solihull, UK.
Equally space the digits 0-9 on a circle. The digits of the decimal expansion of rational numbers can be connected on this circle to form data visualizations. This sequence is useful, cf. A007732 or A051626, for identifying the complexity of that visualization.
EXAMPLE
1/1 is 1.0. There are no decimal digits, so a(1) = 0.
1/2 is 0.5. This is a terminating decimal. There is 1 digit, so a(2) = 1.
1/6 is 0.166666... This is a recurring decimal with a period of 1 (the initial '1' does not recur) so a(6) = 1.
1/7 is 0.142857142857... This is a recurring decimal, with a period of 6 ('142857') so a(7) = 6.
PROG
(Python)
def sequence(n):
..count = 0
..dividend = 1
..remainder = dividend % n
..remainders = [remainder]
..no_recurrence = True
..while remainder != 0:
....count += 1
....dividend = remainder * 10
....remainder = dividend % n
....if remainder in remainders:
......if no_recurrence:
........no_recurrence = False
........remainders = [remainder]
......else:
........return len(remainders)
....else:
......remainders.append(remainder)
..else:
....return count
(PARI) a(n) = my (t=valuation(n, 2), f=valuation(n, 5), r=n/(2^t*5^f)); if (r==1, max(t, f), znorder(Mod(10, r))) \\ Rémy Sigrist, May 08 2019
CROSSREFS
See A114205 and A051628 for the preamble, A036275 and A051626 for the periodic part.
Sequence in context: A372973 A156984 A181621 * A084268 A332405 A332403
KEYWORD
nonn,base,easy
AUTHOR
Luke W. Richards, Mar 22 2019
EXTENSIONS
More terms from Rémy Sigrist, May 08 2019
STATUS
approved