This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A307070 #35 May 22 2025 10:21:48 %S A307070 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, %T A307070 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, %U A307070 60,15,6,6,6,2,33,16,22,6,35,1,8,3,1,18,6,6,13 %N 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. %C A307070 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 %C A307070 This sequence was discovered by a school class (aged 12-13) at Arden School, Solihull, UK. %C A307070 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. %e A307070 1/1 is 1.0. There are no decimal digits, so a(1) = 0. %e A307070 1/2 is 0.5. This is a terminating decimal. There is 1 digit, so a(2) = 1. %e A307070 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. %e A307070 1/7 is 0.142857142857... This is a recurring decimal, with a period of 6 ('142857') so a(7) = 6. %o A307070 (Python) %o A307070 def sequence(n): %o A307070 count = 0 %o A307070 dividend = 1 %o A307070 remainder = dividend % n %o A307070 remainders = [remainder] %o A307070 no_recurrence = True %o A307070 while remainder != 0: %o A307070 count += 1 %o A307070 dividend = remainder * 10 %o A307070 remainder = dividend % n %o A307070 if remainder in remainders: %o A307070 if no_recurrence: %o A307070 no_recurrence = False %o A307070 remainders = [remainder] %o A307070 else: %o A307070 return len(remainders) %o A307070 else: %o A307070 remainders.append(remainder) %o A307070 else: %o A307070 return count %o A307070 (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 %Y A307070 See A114205 and A051628 for the preamble, A036275 and A051626 for the periodic part. %Y A307070 Cf. A001913, A003592, A054710, A121341, A122060. %K A307070 nonn,base,easy %O A307070 1,4 %A A307070 _Luke W. Richards_, Mar 22 2019 %E A307070 More terms from _Rémy Sigrist_, May 08 2019