cp's OEIS Frontend

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.

Showing 1-1 of 1 results.

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.

Original entry on oeis.org

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

Views

Author

Luke W. Richards, Mar 22 2019

Keywords

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.

Examples

			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.
		

Crossrefs

See A114205 and A051628 for the preamble, A036275 and A051626 for the periodic part.

Programs

  • 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
  • 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
    

Extensions

More terms from Rémy Sigrist, May 08 2019
Showing 1-1 of 1 results.